updated docs strings and added README.md
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"module": "openapi_first.binder",
|
||||
"content": {
|
||||
"path": "openapi_first.binder",
|
||||
"docstring": "OpenAPI-driven route binding for FastAPI.\n\n---\n\n## Summary\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\nNotes:\n **Core 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\n **Design 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\n **Constraints:**\n\n - This module intentionally does NOT: Perform request or response validation, generate Pydantic models, modify FastAPI dependency injection, or interpret OpenAPI semantics beyond routing metadata.",
|
||||
"docstring": "# Summary\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\nNotes:\n **Core 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\n **Design 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\n **Constraints:**\n\n - This module intentionally does NOT:\n - Perform request or response validation.\n - Generate Pydantic models.\n - Modify FastAPI dependency injection.\n - Interpret OpenAPI semantics beyond routing metadata.",
|
||||
"objects": {
|
||||
"APIRoute": {
|
||||
"name": "APIRoute",
|
||||
@@ -16,14 +16,14 @@
|
||||
"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\nNotes:\n **Scenarios:**\n\n - An OpenAPI operation does not define an operationId\n - An operationId is defined but no matching function exists in the provided routes module\n\n **Guarantees:**\n\n - This represents a violation of the OpenAPI-first contract and indicates that the specification and implementation are out of sync"
|
||||
"docstring": "Raised when an OpenAPI operation cannot be resolved to a handler.\n\nNotes:\n **Scenarios:**\n\n - An OpenAPI operation does not define an `operationId`.\n - An `operationId` is defined but no matching function exists in\n the provided routes module.\n\n **Guarantees:**\n\n - This represents a violation of the OpenAPI-first contract and\n indicates that the specification and implementation are out of\n sync."
|
||||
},
|
||||
"bind_routes": {
|
||||
"name": "bind_routes",
|
||||
"kind": "function",
|
||||
"path": "openapi_first.binder.bind_routes",
|
||||
"signature": "<bound method Function.signature of Function('bind_routes', 38, 93)>",
|
||||
"docstring": "Bind OpenAPI operations to FastAPI routes.\n\nArgs:\n app (fastapi.FastAPI):\n The FastAPI application instance to which routes will be added.\n spec (dict):\n Parsed OpenAPI 3.x specification dictionary.\n routes_module (module):\n Python module containing handler functions. Each handler's name MUST exactly match an OpenAPI operationId.\n\nRaises:\n MissingOperationHandler:\n If an operationId is missing from the spec or if no corresponding handler function exists in the routes module.\n\nNotes:\n **Responsibilities:**\n\n - Iterates through the OpenAPI specification paths and methods\n - Resolves each operationId to a handler function, and registers a corresponding APIRoute on the FastAPI application\n\n **Guarantees:**\n\n - Route registration is deterministic and spec-driven. No route decorators are required or supported. Handler resolution errors surface at application startup."
|
||||
"signature": "<bound method Function.signature of Function('bind_routes', 40, 100)>",
|
||||
"docstring": "Bind OpenAPI operations to FastAPI routes.\n\nArgs:\n app (fastapi.FastAPI):\n The FastAPI application instance to which routes will be added.\n spec (dict):\n Parsed OpenAPI 3.x specification dictionary.\n routes_module (module):\n Python module containing handler functions. Each handler's name MUST\n exactly match an OpenAPI `operationId`.\n\nRaises:\n MissingOperationHandler:\n If an `operationId` is missing from the spec or if no corresponding\n handler function exists in the routes module.\n\nNotes:\n **Responsibilities:**\n\n - Iterates through the OpenAPI specification paths and methods.\n - Resolves each `operationId` to a handler function, and registers\n a corresponding `APIRoute` on the FastAPI application.\n\n **Guarantees:**\n\n - Route registration is deterministic and spec-driven. No route\n decorators are required or supported. Handler resolution errors\n surface at application startup."
|
||||
},
|
||||
"Any": {
|
||||
"name": "Any",
|
||||
|
||||
Reference in New Issue
Block a user