Files
docs/openapi-first/mcp/modules/openapi_first.templates.health_app.main.json
Vishesh 'ironeagle' Bangotra fced40af59 feat(standards): codify codegen, ship generic Tier-B infra, add get_app_template + prompts; fix docs:// regressions
P0: fix doc:// -> docs:// across standards src/server/registry and regenerate stale mongo-ops bundle. P1: build recipe + spec-first routing now document the openapi-first codegen fast path (models/routes with --inject-request/--package). P4: CRUD template documents the model-vs-document id rule (BaseDocument owns id). P5: authless guidance (omit security keys). P6: template gains generic infra (http_cache, keyed SSE bus, KV port+in-memory+Redis), interfaces/openapi.py + .dockerignore + generic build test registered as components, and a get_app_template tool; genericity matrix marks LLM pool + human-in-loop as reference-app patterns. P7: intake/build/start_app/trial prompts. P8: template ships tests/integration/test_openapi_app_builds.py. Rebuilt standards + openapi-first bundles and re-collected.
2026-10-13 03:26:51 +05:30

32 lines
3.6 KiB
JSON

{
"module": "openapi_first.templates.health_app.main",
"content": {
"path": "openapi_first.templates.health_app.main",
"docstring": "Application entry point for an OpenAPI-first FastAPI service.\n\nThis module constructs a FastAPI application exclusively from an\nOpenAPI specification and a handler namespace, without using\ndecorator-driven routing.\n\nAll HTTP routes, methods, and operation bindings are defined in the\nOpenAPI document referenced by ``openapi_path``. Python callables\ndefined in the ``routes`` module are bound to OpenAPI operations\nstrictly via ``operationId``.\n\nThis module contains no routing logic, request handling, or framework\nconfiguration beyond application assembly.\n\nDesign guarantees:\n- OpenAPI is the single source of truth\n- No undocumented routes can exist\n- Every OpenAPI operationId must resolve to exactly one handler\n- All contract violations fail at application startup\n\nThis file is intended to be used as the ASGI entry point.\n\nExample:\n uvicorn main:app",
"objects": {
"OpenAPIFirstApp": {
"name": "OpenAPIFirstApp",
"kind": "class",
"path": "openapi_first.templates.health_app.main.OpenAPIFirstApp",
"signature": "OpenAPIFirstApp(*, openapi_path: str, routes_module: Any, **fastapi_kwargs: Any)",
"docstring": "FastAPI application enforcing OpenAPI-first design.\n\nArgs:\n openapi_path (str):\n Filesystem path to the OpenAPI 3.x specification file. This\n specification is treated as the authoritative API contract.\n routes_module (ModuleType):\n Python module containing handler functions whose names correspond\n exactly to OpenAPI ``operationId`` values.\n **fastapi_kwargs (Any):\n Additional keyword arguments passed directly to\n ``fastapi.FastAPI`` (e.g., title, version, middleware, lifespan\n handlers).\n\nRaises:\n OpenAPIFirstError:\n If the OpenAPI specification is invalid, or if any declared\n ``operationId`` does not have a corresponding handler function.\n\nNotes:\n **Responsibilities:**\n\n - `OpenAPIFirstApp` subclasses `FastAPI` and replaces manual route\n registration with OpenAPI-driven binding.\n - All routes are derived from the provided OpenAPI specification,\n and each ``operationId`` is mapped to a Python function in the\n supplied routes module.\n - Auth dependencies are auto-injected from the spec's\n ``securitySchemes`` and per-operation ``security`` fields.\n\n **Guarantees:**\n\n - No route can exist without an OpenAPI declaration.\n - No OpenAPI operation can exist without a handler.\n - Swagger UI and ``/openapi.json`` always reflect the provided spec.\n - Handler functions remain framework-agnostic and testable.\n - Auth enforcement is driven entirely by the spec — no manual\n middleware or decorators required.\n\nExample:\n ```python\n from openapi_first.app import OpenAPIFirstApp\n import app.routes as routes\n\n app = OpenAPIFirstApp(\n openapi_path=\"app/openapi.json\",\n routes_module=routes,\n title=\"Example Service\",\n )\n ```",
"members": {
"openapi": {
"name": "openapi",
"kind": "attribute",
"path": "openapi_first.templates.health_app.main.OpenAPIFirstApp.openapi",
"signature": null,
"docstring": null
}
}
},
"app": {
"name": "app",
"kind": "attribute",
"path": "openapi_first.templates.health_app.main.app",
"signature": null,
"docstring": null
}
}
}
}