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:
@@ -4,34 +4,6 @@
|
||||
"path": "openapi_first.cli",
|
||||
"docstring": "# Summary\n\nCommand-line interface for FastAPI OpenAPI-first scaffolding utilities.\n\nThis CLI bootstraps OpenAPI-first FastAPI applications from versioned,\nbundled templates packaged with the library.",
|
||||
"objects": {
|
||||
"argparse": {
|
||||
"name": "argparse",
|
||||
"kind": "alias",
|
||||
"path": "openapi_first.cli.argparse",
|
||||
"signature": "<bound method Alias.signature of Alias('argparse', 'argparse')>",
|
||||
"docstring": null
|
||||
},
|
||||
"shutil": {
|
||||
"name": "shutil",
|
||||
"kind": "alias",
|
||||
"path": "openapi_first.cli.shutil",
|
||||
"signature": "<bound method Alias.signature of Alias('shutil', 'shutil')>",
|
||||
"docstring": null
|
||||
},
|
||||
"resources": {
|
||||
"name": "resources",
|
||||
"kind": "alias",
|
||||
"path": "openapi_first.cli.resources",
|
||||
"signature": "<bound method Alias.signature of Alias('resources', 'importlib.resources')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Path": {
|
||||
"name": "Path",
|
||||
"kind": "alias",
|
||||
"path": "openapi_first.cli.Path",
|
||||
"signature": "<bound method Alias.signature of Alias('Path', 'pathlib.Path')>",
|
||||
"docstring": null
|
||||
},
|
||||
"DEFAULT_TEMPLATE": {
|
||||
"name": "DEFAULT_TEMPLATE",
|
||||
"kind": "attribute",
|
||||
@@ -43,21 +15,21 @@
|
||||
"name": "available_templates",
|
||||
"kind": "function",
|
||||
"path": "openapi_first.cli.available_templates",
|
||||
"signature": "<bound method Function.signature of Function('available_templates', 18, 31)>",
|
||||
"signature": "available_templates() -> list[str]",
|
||||
"docstring": "Return a list of available application templates.\n\nReturns:\n list[str]:\n Sorted list of template names found in the internal templates directory."
|
||||
},
|
||||
"copy_template": {
|
||||
"name": "copy_template",
|
||||
"kind": "function",
|
||||
"path": "openapi_first.cli.copy_template",
|
||||
"signature": "<bound method Function.signature of Function('copy_template', 34, 62)>",
|
||||
"signature": "copy_template(template: str, target_dir: Path) -> None",
|
||||
"docstring": "Copy a bundled OpenAPI-first application template into a directory.\n\nArgs:\n template (str):\n Name of the template to copy.\n target_dir (Path):\n Filesystem path where the template should be copied.\n\nRaises:\n FileNotFoundError:\n If the requested template does not exist."
|
||||
},
|
||||
"main": {
|
||||
"name": "main",
|
||||
"kind": "function",
|
||||
"path": "openapi_first.cli.main",
|
||||
"signature": "<bound method Function.signature of Function('main', 65, 194)>",
|
||||
"signature": "main() -> None",
|
||||
"docstring": null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user