Skip to content

Commit

Permalink
Merge pull request #19 from amvid/feature/openapi-support
Browse files Browse the repository at this point in the history
Draft: feature: openapi spec support and swagger ui
  • Loading branch information
amvid authored Mar 24, 2024
2 parents e289f64 + 0929f41 commit 8e37cbd
Show file tree
Hide file tree
Showing 85 changed files with 3,062 additions and 245 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
APP_ENV=dev
APP_SECRET=26d0c51cd74d7f0e55a6f170988c6cb9
APP_NUM_WORKERS=1

API_AUTH_TOKEN=qwerty
API_AUTH_ENABLED=false
API_AUTH_ENABLED=true

DATABASE_URL="mysql://geo-service:qwerty@geo-service-db:3306/geo-service?serverVersion=10.9.3-MariaDB&charset=utf8mb4"
8 changes: 3 additions & 5 deletions .rr.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ server:
command: "php public/index.php"
env:
- APP_RUNTIME: Baldinof\RoadRunnerBundle\Runtime\Runtime
- XDEBUG_SESSION: 1

http:
address: 0.0.0.0:8080
middleware: [ "static", "gzip" ]
pool:
num_workers: ${APP_NUM_WORKERS:-1}
debug: true
uploads:
forbid: [ ".php", ".exe", ".bat" ]
static:
dir: "public"
forbid: [ ".php", ".htaccess" ]
forbid: [ ".php" ]

logs:
mode: development
Expand All @@ -24,5 +24,3 @@ logs:
server:
level: info # Everything written to worker stderr is logged
mode: raw
metrics:
level: debug
5 changes: 2 additions & 3 deletions .rr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ http:
address: 0.0.0.0:8080
pool:
debug: false
num_workers: ${APP_NUM_WORKERS:-1}
middleware: [ "static", "gzip" ]
uploads:
forbid: [ ".php", ".exe", ".bat" ]
static:
dir: "public"
forbid: [ ".php", ".htaccess" ]
forbid: [ ".php" ]

logs:
mode: production
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ migration:
migrate:
@docker exec geo-service-app-dev sh -c "php bin/console d:m:m"

openapi:
@docker exec -it geo-service-app-dev sh -c "bin/console nelmio:apidoc:dump --format=yaml > openapi.yaml"

cache:
@docker exec geo-service-app-dev sh -c "bin/console cache:clear"

.PHONY: user
user:
@docker exec -it geo-service-app-dev php bin/console app:create-user
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@ Geo data REST API service with admin dashboard to manage regions, countries, nat
[PHP8.3](https://www.php.net/releases/8.3/en.php) |
[Symfony 6](https://symfony.com) |
[EasyAdminBundle](https://symfony.com/bundles/EasyAdminBundle/current/index.html)
[OpenAPI](https://swagger.io/specification/)

### Admin Dashboard

![Screenshot](docs/img/country_dark.png)
![Screenshot](docs/img/airport_light.png)

### Swagger UI

```text
https://127.0.0.1:8085/apidoc
```

### Installation

```bash
Expand All @@ -38,6 +46,14 @@ make user
make test
```

### OpenAPI

Regenerate openapi.yaml in project root directory

```bash
make openapi
```

### Import

All geo data
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"doctrine/doctrine-migrations-bundle": "^3.3",
"easycorp/easyadmin-bundle": "^4.9",
"halaxa/json-machine": "^1.1",
"nelmio/api-doc-bundle": "^4.24",
"ramsey/uuid": "^4.7",
"ramsey/uuid-doctrine": "^2.0",
"symfony/browser-kit": "6.4.*",
Expand Down
Loading

0 comments on commit 8e37cbd

Please sign in to comment.