Add swagger-drogon generator

This commit is contained in:
gabdevele
2026-06-03 01:52:43 +02:00 Unverified
parent 1043768da7
commit 21883a4a8f
19 changed files with 1672 additions and 203 deletions
+6 -2
View File
@@ -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