Add swagger-drogon generator
This commit is contained in:
@@ -77,12 +77,16 @@ discoverable by CMake. The default build uses CPM.cmake and downloads Drogon
|
||||
|
||||
## OpenAPI
|
||||
|
||||
The OpenAPI spec is generated from Drogon controller route macros, not written
|
||||
as a static Swagger file.
|
||||
The OpenAPI spec is generated with `scripts/swagger-drogon/`. The generator
|
||||
discovers Drogon controller route macros, reads adjacent `openapi:` metadata,
|
||||
infers simple query/body/response shapes from C++ code, then merges the Visione
|
||||
schema registry in `docs/openapi/visione.yaml`. Generation fails if an endpoint
|
||||
still has generic request or response schemas.
|
||||
|
||||
```bash
|
||||
cmake --build build --target openapi
|
||||
python3 -m json.tool build/openapi/visione.openapi.json >/dev/null
|
||||
python3 -m unittest discover scripts/swagger-drogon/tests
|
||||
```
|
||||
|
||||
The app serves the generated JSON at `/api/v1/openapi.json` and Swagger UI at
|
||||
|
||||
Reference in New Issue
Block a user