feat: codegen routes — sanitize resource names, --inject-request/--package, expand form bodies

codegen_routes.generate_routes now sanitizes resource identifiers (fetch-requests -> fetch_requests), optionally prepends 'request: Request' (inject_request) and emits <resource>/routes.py packages with __init__.py (package). multipart/form-data and x-www-form-urlencoded bodies expand to per-property UploadFile/File/Form params instead of an opaque dict; spec paths are normalized to forward slashes to avoid Windows escape issues. Adds CLI flags --inject-request/--package, 7 focused tests, and refreshes lib/wiki/MCP docs to the real CLI.
This commit is contained in:
2026-10-13 03:26:31 +05:30
parent b559323dfe
commit 51ffb4aae9
38 changed files with 1156 additions and 3027 deletions

View File

@@ -4,39 +4,18 @@
"path": "openapi_first.templates.vet_app.sse",
"docstring": null,
"objects": {
"asyncio": {
"name": "asyncio",
"kind": "alias",
"path": "openapi_first.templates.vet_app.sse.asyncio",
"signature": "<bound method Alias.signature of Alias('asyncio', 'asyncio')>",
"docstring": null
},
"random": {
"name": "random",
"kind": "alias",
"path": "openapi_first.templates.vet_app.sse.random",
"signature": "<bound method Alias.signature of Alias('random', 'random')>",
"docstring": null
},
"json": {
"name": "json",
"kind": "alias",
"path": "openapi_first.templates.vet_app.sse.json",
"signature": "<bound method Alias.signature of Alias('json', 'json')>",
"docstring": null
},
"subscribe": {
"name": "subscribe",
"kind": "function",
"path": "openapi_first.templates.vet_app.sse.subscribe",
"signature": "<bound method Function.signature of Function('subscribe', 33, 37)>",
"signature": "subscribe(pet_id: int, species: str) -> asyncio.Queue",
"docstring": null
},
"unsubscribe": {
"name": "unsubscribe",
"kind": "function",
"path": "openapi_first.templates.vet_app.sse.unsubscribe",
"signature": "<bound method Function.signature of Function('unsubscribe', 40, 48)>",
"signature": "unsubscribe(pet_id: int, q: asyncio.Queue)",
"docstring": null
}
}