Files
openapi-first/mcp_docs/modules/openapi_first.binder.json

51 lines
4.1 KiB
JSON

{
"module": "openapi_first.binder",
"content": {
"path": "openapi_first.binder",
"docstring": "openapi_first.binder\n============================\n\nOpenAPI-driven route binding for FastAPI.\n\nThis module is responsible for translating an OpenAPI 3.x specification\ninto concrete FastAPI routes. It enforces a strict one-to-one mapping\nbetween OpenAPI operations and Python handler functions using operationId.\n\nCore responsibility\n-------------------\n- Read path + method definitions from an OpenAPI specification\n- Resolve each operationId to a Python callable\n- Register routes with FastAPI using APIRoute\n- Fail fast when contract violations are detected\n\nDesign constraints\n------------------\n- All routes MUST be declared in the OpenAPI specification.\n- All OpenAPI operations MUST define an operationId.\n- Every operationId MUST resolve to a handler function.\n- Handlers are plain Python callables (no decorators required).\n- No implicit route creation or inference is allowed.\n\nThis module intentionally does NOT:\n-------------------------------\n- Perform request or response validation\n- Generate Pydantic models\n- Modify FastAPI dependency injection\n- Interpret OpenAPI semantics beyond routing metadata\n\nThose concerns belong to other layers or tooling.",
"objects": {
"APIRoute": {
"name": "APIRoute",
"kind": "alias",
"path": "openapi_first.binder.APIRoute",
"signature": "<bound method Alias.signature of Alias('APIRoute', 'fastapi.routing.APIRoute')>",
"docstring": null
},
"MissingOperationHandler": {
"name": "MissingOperationHandler",
"kind": "class",
"path": "openapi_first.binder.MissingOperationHandler",
"signature": "<bound method Alias.signature of Alias('MissingOperationHandler', 'openapi_first.errors.MissingOperationHandler')>",
"docstring": "Raised when an OpenAPI operation cannot be resolved to a handler.\n\nThis error occurs when:\n- An OpenAPI operation does not define an operationId, or\n- An operationId is defined but no matching function exists in the\n provided routes module.\n\nThis represents a violation of the OpenAPI-first contract and\nindicates that the specification and implementation are out of sync."
},
"bind_routes": {
"name": "bind_routes",
"kind": "function",
"path": "openapi_first.binder.bind_routes",
"signature": "<bound method Function.signature of Function('bind_routes', 41, 102)>",
"docstring": "Bind OpenAPI operations to FastAPI routes.\n\nIterates through the OpenAPI specification paths and methods,\nresolves each operationId to a handler function, and registers\na corresponding APIRoute on the FastAPI application.\n\nParameters\n----------\napp : fastapi.FastAPI\n The FastAPI application instance to which routes will be added.\n\nspec : dict\n Parsed OpenAPI 3.x specification dictionary.\n\nroutes_module : module\n Python module containing handler functions. Each handler's\n name MUST exactly match an OpenAPI operationId.\n\nRaises\n------\nMissingOperationHandler\n If an operationId is missing from the spec or if no corresponding\n handler function exists in the routes module.\n\nBehavior guarantees\n-------------------\n- Route registration is deterministic and spec-driven.\n- No route decorators are required or supported.\n- Handler resolution errors surface at application startup."
},
"Any": {
"name": "Any",
"kind": "alias",
"path": "openapi_first.binder.Any",
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
"docstring": null
},
"Dict": {
"name": "Dict",
"kind": "alias",
"path": "openapi_first.binder.Dict",
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
"docstring": null
},
"FastAPI": {
"name": "FastAPI",
"kind": "alias",
"path": "openapi_first.binder.FastAPI",
"signature": "<bound method Alias.signature of Alias('FastAPI', 'fastapi.FastAPI')>",
"docstring": null
}
}
}
}