feat: emit template-style route stubs (async, body param, service hint)

Add generate_routes(template_style=...) and CLI --template-style. When on,
stubs use async def, a JSON body parameter named body (dict or Model), and
with --inject-request a service-lookup hint comment before NotImplementedError.
Default behaviour (def/payload) unchanged. +2 tests (32 passed), wiki + MCP
bundle regenerated.
This commit is contained in:
2026-10-13 19:35:04 +05:30
parent 51ffb4aae9
commit 9cb8bf8f1c
8 changed files with 125 additions and 16 deletions

View File

@@ -143,6 +143,12 @@ def main() -> None:
default=False,
help="Emit one `<resource>/routes.py` package per resource",
)
routes_parser.add_argument(
"--template-style",
action="store_true",
default=False,
help="Emit async handlers with a `body` parameter (template convention)",
)
args = parser.parse_args()
@@ -167,6 +173,7 @@ def main() -> None:
models_module=args.models_module,
inject_request=args.inject_request,
package=args.package,
template_style=args.template_style,
)
print(f"Generated {len(files)} route file(s):")
for f in files: