Files
docs/libs/openapi-first/site/search/search_index.json
Vishesh 'ironeagle' Bangotra 9191de9dff
All checks were successful
continuous-integration/drone/push Build is passing
Build: 0.1.8
2026-03-08 01:01:39 +05:30

1 line
80 KiB
JSON

{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"openapi_first","text":"<ul> <li>Openapi First</li> </ul>"},{"location":"#openapi_first","title":"openapi_first","text":"<p>FastAPI OpenAPI First \u2014 strict OpenAPI-first application bootstrap for FastAPI.</p>"},{"location":"#openapi_first--summary","title":"Summary","text":"<p>FastAPI OpenAPI First is a contract-first infrastructure library that enforces OpenAPI as the single source of truth for FastAPI services.</p> <p>The library removes decorator-driven routing and replaces it with deterministic, spec-driven application assembly. Every HTTP route, method, and operation is defined in OpenAPI first and bound to Python handlers explicitly via operationId.</p>"},{"location":"#openapi_first--installation","title":"Installation","text":"<p>Install using pip:</p> <pre><code>pip install openapi-first\n</code></pre> <p>Or with Poetry:</p> <pre><code>poetry add openapi-first\n</code></pre>"},{"location":"#openapi_first--quick-start","title":"Quick start","text":"<p>Minimal OpenAPI-first FastAPI application:</p> <pre><code>from openapi_first import app\nimport my_service.routes as routes\n\napi = app.OpenAPIFirstApp(\n openapi_path=\"openapi.yaml\",\n routes_module=routes,\n title=\"My Service\",\n version=\"1.0.0\",\n)\n</code></pre> <p>OperationId-driven HTTP client:</p> <pre><code>from openapi_first.loader import load_openapi\nfrom openapi_first.client import OpenAPIClient\n\nspec = load_openapi(\"openapi.yaml\")\nclient = OpenAPIClient(spec)\n\nresponse = client.get_health()\n</code></pre>"},{"location":"#openapi_first--architecture","title":"Architecture","text":"<p>The library is structured around four core responsibilities:</p> <ul> <li>loader: Load and validate OpenAPI 3.x specifications (JSON/YAML)</li> <li>binder: Bind OpenAPI operations to FastAPI routes via operationId</li> <li>app: OpenAPI-first FastAPI application bootstrap</li> <li>client: OpenAPI-first HTTP client driven by the same specification</li> <li>errors: Explicit error hierarchy for contract violations</li> </ul>"},{"location":"#openapi_first--public-api","title":"Public API","text":"<p>The supported public API consists of the following top-level modules:</p> <ul> <li><code>openapi_first.app</code></li> <li><code>openapi_first.binder</code></li> <li><code>openapi_first.loader</code></li> <li><code>openapi_first.client</code></li> <li><code>openapi_first.errors</code></li> </ul>"},{"location":"#openapi_first--design-guarantees","title":"Design Guarantees","text":"<ul> <li>OpenAPI is the single source of truth</li> <li>No undocumented routes can exist</li> <li>No OpenAPI operation can exist without a handler or client callable</li> <li>All contract violations fail at application startup or client creation</li> <li>No hidden FastAPI magic or implicit behavior</li> <li>Deterministic, testable application assembly</li> </ul>"},{"location":"app/","title":"App","text":""},{"location":"app/#openapi_first.app","title":"openapi_first.app","text":"<p>OpenAPI-first application bootstrap for FastAPI.</p>"},{"location":"app/#openapi_first.app--summary","title":"Summary","text":"<p>This module provides <code>OpenAPIFirstApp</code>, a thin but strict abstraction that enforces OpenAPI as the single source of truth for a FastAPI service.</p> Notes <p>Core Principles:</p> <pre><code>- The OpenAPI specification (JSON or YAML) defines the entire API surface\n- Every operationId in the OpenAPI spec must have a corresponding Python handler function\n- Handlers are plain Python callables (no FastAPI decorators)\n- FastAPI route registration is derived exclusively from the spec\n- FastAPI's autogenerated OpenAPI schema is fully overridden\n</code></pre> <p>Responsibilities:</p> <pre><code>- Loads and validates an OpenAPI 3.x specification\n- Dynamically binds HTTP routes to handler functions using operationId\n- Registers routes with FastAPI at application startup\n- Ensures runtime behavior matches the OpenAPI contract exactly\n</code></pre> <p>Constraints:</p> <pre><code>- This module intentionally does NOT: Generate OpenAPI specs, generate client code, introduce a new framework or lifecycle, or alter FastAPI dependency injection semantics.\n</code></pre>"},{"location":"app/#openapi_first.app-classes","title":"Classes","text":""},{"location":"app/#openapi_first.app.OpenAPIFirstApp","title":"OpenAPIFirstApp","text":"<pre><code>OpenAPIFirstApp(*, openapi_path: str, routes_module: Any, **fastapi_kwargs: Any)\n</code></pre> <p> Bases: <code>FastAPI</code></p> <p>FastAPI application enforcing OpenAPI-first design.</p> Notes <p>Responsibilities:</p> <pre><code>- `OpenAPIFirstApp` subclasses FastAPI and replaces manual route registration with OpenAPI-driven binding\n- All routes are derived from the provided OpenAPI specification, and each operationId is mapped to a Python function in the supplied routes module\n</code></pre> <p>Guarantees:</p> <pre><code>- 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</code></pre> Example <pre><code>from openapi_first import OpenAPIFirstApp\nimport app.routes as routes\n\napp = OpenAPIFirstApp(\n openapi_path=\"app/openapi.json\",\n routes_module=routes,\n title=\"Example Service\",\n)\n</code></pre> <p>Initialize the application.</p> <p>Parameters:</p> Name Type Description Default <code>openapi_path</code> <code>str</code> <p>Filesystem path to the OpenAPI 3.x specification file. This specification is treated as the authoritative API contract.</p> required <code>routes_module</code> <code>module</code> <p>Python module containing handler functions whose names correspond exactly to OpenAPI operationId values.</p> required <code>**fastapi_kwargs</code> <code>Any</code> <p>Additional keyword arguments passed directly to <code>fastapi.FastAPI</code> (e.g., title, version, middleware, lifespan handlers).</p> <code>{}</code> <p>Raises:</p> Type Description <code>OpenAPIFirstError</code> <p>If the OpenAPI specification is invalid, or if any declared operationId does not have a corresponding handler function.</p>"},{"location":"app/#openapi_first.app.OpenAPIFirstApp-functions","title":"Functions","text":""},{"location":"app/#openapi_first.app-functions","title":"Functions","text":""},{"location":"binder/","title":"Binder","text":""},{"location":"binder/#openapi_first.binder","title":"openapi_first.binder","text":"<p>OpenAPI-driven route binding for FastAPI.</p>"},{"location":"binder/#openapi_first.binder--summary","title":"Summary","text":"<p>This module is responsible for translating an OpenAPI 3.x specification into concrete FastAPI routes. It enforces a strict one-to-one mapping between OpenAPI operations and Python handler functions using operationId.</p> Notes <p>Core Responsibility:</p> <pre><code>- 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</code></pre> <p>Design Constraints:</p> <pre><code>- 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</code></pre> <p>Constraints:</p> <pre><code>- This module intentionally does NOT: Perform request or response validation, generate Pydantic models, modify FastAPI dependency injection, or interpret OpenAPI semantics beyond routing metadata.\n</code></pre>"},{"location":"binder/#openapi_first.binder-classes","title":"Classes","text":""},{"location":"binder/#openapi_first.binder-functions","title":"Functions","text":""},{"location":"binder/#openapi_first.binder.bind_routes","title":"bind_routes","text":"<pre><code>bind_routes(app: FastAPI, spec: Dict[str, Any], routes_module: Any) -&gt; None\n</code></pre> <p>Bind OpenAPI operations to FastAPI routes.</p> <p>Parameters:</p> Name Type Description Default <code>app</code> <code>FastAPI</code> <p>The FastAPI application instance to which routes will be added.</p> required <code>spec</code> <code>dict</code> <p>Parsed OpenAPI 3.x specification dictionary.</p> required <code>routes_module</code> <code>module</code> <p>Python module containing handler functions. Each handler's name MUST exactly match an OpenAPI operationId.</p> required <p>Raises:</p> Type Description <code>MissingOperationHandler</code> <p>If an operationId is missing from the spec or if no corresponding handler function exists in the routes module.</p> Notes <p>Responsibilities:</p> <pre><code>- 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</code></pre> <p>Guarantees:</p> <pre><code>- Route registration is deterministic and spec-driven. No route decorators are required or supported. Handler resolution errors surface at application startup.\n</code></pre>"},{"location":"cli/","title":"Cli","text":""},{"location":"cli/#openapi_first.cli","title":"openapi_first.cli","text":"<p>Command-line interface for FastAPI OpenAPI-first scaffolding utilities.</p>"},{"location":"cli/#openapi_first.cli--summary","title":"Summary","text":"<p>This CLI bootstraps OpenAPI-first FastAPI applications from versioned, bundled templates packaged with the library.</p>"},{"location":"cli/#openapi_first.cli-functions","title":"Functions","text":""},{"location":"cli/#openapi_first.cli.available_templates","title":"available_templates","text":"<pre><code>available_templates() -&gt; list[str]\n</code></pre> <p>Return a list of available application templates.</p> <p>Returns:</p> Type Description <code>list[str]</code> <p>list[str]: Sorted list of template names found in the internal templates directory.</p>"},{"location":"cli/#openapi_first.cli.copy_template","title":"copy_template","text":"<pre><code>copy_template(template: str, target_dir: Path) -&gt; None\n</code></pre> <p>Copy a bundled OpenAPI-first application template into a directory.</p> <p>Parameters:</p> Name Type Description Default <code>template</code> <code>str</code> <p>Name of the template to copy.</p> required <code>target_dir</code> <code>Path</code> <p>Filesystem path where the template should be copied.</p> required <p>Raises:</p> Type Description <code>FileNotFoundError</code> <p>If the requested template does not exist.</p>"},{"location":"client/","title":"Client","text":""},{"location":"client/#openapi_first.client","title":"openapi_first.client","text":"<p>OpenAPI-first HTTP client for contract-driven services.</p>"},{"location":"client/#openapi_first.client--summary","title":"Summary","text":"<p>This module provides <code>OpenAPIClient</code>, a thin, strict HTTP client that derives all callable operations directly from an OpenAPI 3.x specification.</p> <p>It is the client counterpart to <code>OpenAPIFirstApp</code>.</p> Notes <p>Core Principles:</p> <pre><code>- The OpenAPI specification is the single source of truth\n- Each operationId becomes a callable Python method\n- No implicit schema mutation or inference\n- No code generation step\n- Minimal abstraction over httpx\n</code></pre> <p>Responsibilities:</p> <pre><code>- Parses an OpenAPI 3.x specification\n- Dynamically creates one callable per operationId\n- Enforces presence of servers, paths, and operationId\n- Formats path parameters safely\n- Handles JSON request bodies explicitly\n- Returns raw `httpx.Response` objects\n</code></pre> <p>Constraints:</p> <pre><code>- This module intentionally does NOT: Generate client code, validate request/response schemas, deserialize responses, retry requests, implement authentication helpers, or assume non-2xx responses are failures.\n</code></pre>"},{"location":"client/#openapi_first.client-classes","title":"Classes","text":""},{"location":"client/#openapi_first.client.OpenAPIClient","title":"OpenAPIClient","text":"<pre><code>OpenAPIClient(spec: Dict[str, Any], base_url: Optional[str] = None, client: Optional[httpx.Client] = None)\n</code></pre> <p>OpenAPI-first HTTP client (httpx-based).</p> Notes <p>Responsibilities:</p> <pre><code>- This client derives all callable methods directly from an OpenAPI 3.x specification. Each operationId becomes a method on the client instance.\n</code></pre> <p>Guarantees:</p> <pre><code>- One callable per operationId\n- Explicit parameters (path, query, headers, body)\n- No implicit schema inference or mutation\n- Returns raw `httpx.Response` objects\n- No response validation or deserialization\n</code></pre> Example <pre><code>from openapi_first import loader, client\n\nspec = loader.load_openapi(\"openapi.yaml\")\n\napi = client.OpenAPIClient(\n spec=spec,\n base_url=\"http://localhost:8000\",\n)\n\n# Call operationId: getUser\nresponse = api.getUser(\n path_params={\"user_id\": 123}\n)\n\nprint(response.status_code)\nprint(response.json())\n</code></pre> <p>Initialize the OpenAPI client.</p> <p>Parameters:</p> Name Type Description Default <code>spec</code> <code>dict[str, Any]</code> <p>Parsed OpenAPI 3.x specification.</p> required <code>base_url</code> <code>str</code> <p>Base URL of the target service. If omitted, the first entry in the OpenAPI <code>servers</code> list is used.</p> <code>None</code> <code>client</code> <code>Client</code> <p>Optional preconfigured httpx client instance.</p> <code>None</code> <p>Raises:</p> Type Description <code>OpenAPIClientError</code> <p>If no servers are defined, spec has no paths, operationIds are missing/duplicate, or required parameters are missing.</p>"},{"location":"client/#openapi_first.client.OpenAPIClient-functions","title":"Functions","text":""},{"location":"client/#openapi_first.client.OpenAPIClientError","title":"OpenAPIClientError","text":"<p> Bases: <code>OpenAPIFirstError</code></p> <p>Raised when an OpenAPI client operation fails.</p>"},{"location":"errors/","title":"Errors","text":""},{"location":"errors/#openapi_first.errors","title":"openapi_first.errors","text":"<p>Exceptions for OpenAPI-first FastAPI applications.</p>"},{"location":"errors/#openapi_first.errors--summary","title":"Summary","text":"<p>This module defines a small hierarchy of explicit, intention-revealing exceptions used to signal contract violations between an OpenAPI specification and its Python implementation.</p> Notes <p>Design Principles:</p> <pre><code>- Errors represent programmer mistakes, not runtime conditions\n- All errors are raised during application startup\n- Messages are actionable and suitable for CI/CD output\n- Exceptions are explicit rather than reused from generic built-ins\n</code></pre> <p>These errors should normally cause immediate application failure.</p>"},{"location":"errors/#openapi_first.errors-classes","title":"Classes","text":""},{"location":"errors/#openapi_first.errors.MissingOperationHandler","title":"MissingOperationHandler","text":"<pre><code>MissingOperationHandler(*, path: str, method: str, operation_id: Optional[str] = None)\n</code></pre> <p> Bases: <code>OpenAPIFirstError</code></p> <p>Raised when an OpenAPI operation cannot be resolved to a handler.</p> Notes <p>Scenarios:</p> <pre><code>- An OpenAPI operation does not define an operationId\n- An operationId is defined but no matching function exists in the provided routes module\n</code></pre> <p>Guarantees:</p> <pre><code>- This represents a violation of the OpenAPI-first contract and indicates that the specification and implementation are out of sync\n</code></pre> <p>Initialize the error.</p> <p>Parameters:</p> Name Type Description Default <code>path</code> <code>str</code> <p>The HTTP path declared in the OpenAPI specification.</p> required <code>method</code> <code>str</code> <p>The HTTP method (as declared in the OpenAPI spec).</p> required <code>operation_id</code> <code>str</code> <p>The operationId declared in the OpenAPI spec, if present.</p> <code>None</code>"},{"location":"errors/#openapi_first.errors.MissingOperationHandler-functions","title":"Functions","text":""},{"location":"errors/#openapi_first.errors.OpenAPIFirstError","title":"OpenAPIFirstError","text":"<p> Bases: <code>Exception</code></p> <p>Base exception for all OpenAPI-first enforcement errors.</p> Notes <p>Responsibilities:</p> <pre><code>- This exception exists to allow callers, test suites, and CI pipelines to catch and distinguish OpenAPI contract violations from unrelated runtime errors\n- All exceptions raised by the OpenAPI-first core should inherit from this type\n</code></pre>"},{"location":"loader/","title":"Loader","text":""},{"location":"loader/#openapi_first.loader","title":"openapi_first.loader","text":"<p>OpenAPI specification loading and validation utilities.</p>"},{"location":"loader/#openapi_first.loader--summary","title":"Summary","text":"<p>This module is responsible for loading an OpenAPI 3.x specification from disk and validating it before it is used by the application.</p> <p>It enforces the principle that an invalid or malformed OpenAPI document must never reach the routing or runtime layers.</p> Notes <p>Design Principles:</p> <pre><code>- OpenAPI is treated as an authoritative contract\n- Invalid specifications fail fast at application startup\n- Supported formats are JSON and YAML\n- Validation errors are surfaced clearly and early\n</code></pre> <p>Constraints:</p> <pre><code>- This module intentionally does NOT: Modify the OpenAPI document, infer missing fields, generate models or code, or perform request/response validation at runtime.\n</code></pre>"},{"location":"loader/#openapi_first.loader-classes","title":"Classes","text":""},{"location":"loader/#openapi_first.loader.OpenAPISpecLoadError","title":"OpenAPISpecLoadError","text":"<p> Bases: <code>OpenAPIFirstError</code></p> <p>Raised when an OpenAPI specification cannot be loaded or validated.</p> Notes <p>Guarantees:</p> <pre><code>- This error indicates that the OpenAPI document is unreadable, malformed, or violates the OpenAPI 3.x specification\n</code></pre>"},{"location":"loader/#openapi_first.loader-functions","title":"Functions","text":""},{"location":"loader/#openapi_first.loader.load_openapi","title":"load_openapi","text":"<pre><code>load_openapi(path: Union[str, Path]) -&gt; Dict[str, Any]\n</code></pre> <p>Load and validate an OpenAPI 3.x specification from disk.</p> <p>Parameters:</p> Name Type Description Default <code>path</code> <code>str | Path</code> <p>Filesystem path to an OpenAPI specification file. Supported extensions: .json, .yaml, .yml.</p> required <p>Returns:</p> Type Description <code>Dict[str, Any]</code> <p>dict[str, Any]: Parsed and validated OpenAPI specification.</p> <p>Raises:</p> Type Description <code>OpenAPISpecLoadError</code> <p>If the file does not exist, cannot be parsed, or fails OpenAPI schema validation.</p> Notes <p>Guarantees:</p> <pre><code>- The specification is parsed based on file extension and validated using a strict OpenAPI schema validator\n- Any error results in an immediate exception, preventing application startup\n</code></pre>"},{"location":"openapi_first/","title":"Openapi First","text":"<ul> <li>App</li> <li>Binder</li> <li>Cli</li> <li>Client</li> <li>Errors</li> <li>Loader</li> <li>Templates</li> </ul>"},{"location":"openapi_first/#openapi_first","title":"openapi_first","text":"<p>FastAPI OpenAPI First \u2014 strict OpenAPI-first application bootstrap for FastAPI.</p>"},{"location":"openapi_first/#openapi_first--summary","title":"Summary","text":"<p>FastAPI OpenAPI First is a contract-first infrastructure library that enforces OpenAPI as the single source of truth for FastAPI services.</p> <p>The library removes decorator-driven routing and replaces it with deterministic, spec-driven application assembly. Every HTTP route, method, and operation is defined in OpenAPI first and bound to Python handlers explicitly via operationId.</p>"},{"location":"openapi_first/#openapi_first--installation","title":"Installation","text":"<p>Install using pip:</p> <pre><code>pip install openapi-first\n</code></pre> <p>Or with Poetry:</p> <pre><code>poetry add openapi-first\n</code></pre>"},{"location":"openapi_first/#openapi_first--quick-start","title":"Quick start","text":"<p>Minimal OpenAPI-first FastAPI application:</p> <pre><code>from openapi_first import app\nimport my_service.routes as routes\n\napi = app.OpenAPIFirstApp(\n openapi_path=\"openapi.yaml\",\n routes_module=routes,\n title=\"My Service\",\n version=\"1.0.0\",\n)\n</code></pre> <p>OperationId-driven HTTP client:</p> <pre><code>from openapi_first.loader import load_openapi\nfrom openapi_first.client import OpenAPIClient\n\nspec = load_openapi(\"openapi.yaml\")\nclient = OpenAPIClient(spec)\n\nresponse = client.get_health()\n</code></pre>"},{"location":"openapi_first/#openapi_first--architecture","title":"Architecture","text":"<p>The library is structured around four core responsibilities:</p> <ul> <li>loader: Load and validate OpenAPI 3.x specifications (JSON/YAML)</li> <li>binder: Bind OpenAPI operations to FastAPI routes via operationId</li> <li>app: OpenAPI-first FastAPI application bootstrap</li> <li>client: OpenAPI-first HTTP client driven by the same specification</li> <li>errors: Explicit error hierarchy for contract violations</li> </ul>"},{"location":"openapi_first/#openapi_first--public-api","title":"Public API","text":"<p>The supported public API consists of the following top-level modules:</p> <ul> <li><code>openapi_first.app</code></li> <li><code>openapi_first.binder</code></li> <li><code>openapi_first.loader</code></li> <li><code>openapi_first.client</code></li> <li><code>openapi_first.errors</code></li> </ul>"},{"location":"openapi_first/#openapi_first--design-guarantees","title":"Design Guarantees","text":"<ul> <li>OpenAPI is the single source of truth</li> <li>No undocumented routes can exist</li> <li>No OpenAPI operation can exist without a handler or client callable</li> <li>All contract violations fail at application startup or client creation</li> <li>No hidden FastAPI magic or implicit behavior</li> <li>Deterministic, testable application assembly</li> </ul>"},{"location":"openapi_first/app/","title":"App","text":""},{"location":"openapi_first/app/#openapi_first.app","title":"openapi_first.app","text":"<p>OpenAPI-first application bootstrap for FastAPI.</p>"},{"location":"openapi_first/app/#openapi_first.app--summary","title":"Summary","text":"<p>This module provides <code>OpenAPIFirstApp</code>, a thin but strict abstraction that enforces OpenAPI as the single source of truth for a FastAPI service.</p> Notes <p>Core Principles:</p> <pre><code>- The OpenAPI specification (JSON or YAML) defines the entire API surface\n- Every operationId in the OpenAPI spec must have a corresponding Python handler function\n- Handlers are plain Python callables (no FastAPI decorators)\n- FastAPI route registration is derived exclusively from the spec\n- FastAPI's autogenerated OpenAPI schema is fully overridden\n</code></pre> <p>Responsibilities:</p> <pre><code>- Loads and validates an OpenAPI 3.x specification\n- Dynamically binds HTTP routes to handler functions using operationId\n- Registers routes with FastAPI at application startup\n- Ensures runtime behavior matches the OpenAPI contract exactly\n</code></pre> <p>Constraints:</p> <pre><code>- This module intentionally does NOT: Generate OpenAPI specs, generate client code, introduce a new framework or lifecycle, or alter FastAPI dependency injection semantics.\n</code></pre>"},{"location":"openapi_first/app/#openapi_first.app-classes","title":"Classes","text":""},{"location":"openapi_first/app/#openapi_first.app.OpenAPIFirstApp","title":"OpenAPIFirstApp","text":"<pre><code>OpenAPIFirstApp(*, openapi_path: str, routes_module: Any, **fastapi_kwargs: Any)\n</code></pre> <p> Bases: <code>FastAPI</code></p> <p>FastAPI application enforcing OpenAPI-first design.</p> Notes <p>Responsibilities:</p> <pre><code>- `OpenAPIFirstApp` subclasses FastAPI and replaces manual route registration with OpenAPI-driven binding\n- All routes are derived from the provided OpenAPI specification, and each operationId is mapped to a Python function in the supplied routes module\n</code></pre> <p>Guarantees:</p> <pre><code>- 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</code></pre> Example <pre><code>from openapi_first import OpenAPIFirstApp\nimport app.routes as routes\n\napp = OpenAPIFirstApp(\n openapi_path=\"app/openapi.json\",\n routes_module=routes,\n title=\"Example Service\",\n)\n</code></pre> <p>Initialize the application.</p> <p>Parameters:</p> Name Type Description Default <code>openapi_path</code> <code>str</code> <p>Filesystem path to the OpenAPI 3.x specification file. This specification is treated as the authoritative API contract.</p> required <code>routes_module</code> <code>module</code> <p>Python module containing handler functions whose names correspond exactly to OpenAPI operationId values.</p> required <code>**fastapi_kwargs</code> <code>Any</code> <p>Additional keyword arguments passed directly to <code>fastapi.FastAPI</code> (e.g., title, version, middleware, lifespan handlers).</p> <code>{}</code> <p>Raises:</p> Type Description <code>OpenAPIFirstError</code> <p>If the OpenAPI specification is invalid, or if any declared operationId does not have a corresponding handler function.</p>"},{"location":"openapi_first/app/#openapi_first.app.OpenAPIFirstApp-functions","title":"Functions","text":""},{"location":"openapi_first/app/#openapi_first.app-functions","title":"Functions","text":""},{"location":"openapi_first/binder/","title":"Binder","text":""},{"location":"openapi_first/binder/#openapi_first.binder","title":"openapi_first.binder","text":"<p>OpenAPI-driven route binding for FastAPI.</p>"},{"location":"openapi_first/binder/#openapi_first.binder--summary","title":"Summary","text":"<p>This module is responsible for translating an OpenAPI 3.x specification into concrete FastAPI routes. It enforces a strict one-to-one mapping between OpenAPI operations and Python handler functions using operationId.</p> Notes <p>Core Responsibility:</p> <pre><code>- 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</code></pre> <p>Design Constraints:</p> <pre><code>- 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</code></pre> <p>Constraints:</p> <pre><code>- This module intentionally does NOT: Perform request or response validation, generate Pydantic models, modify FastAPI dependency injection, or interpret OpenAPI semantics beyond routing metadata.\n</code></pre>"},{"location":"openapi_first/binder/#openapi_first.binder-classes","title":"Classes","text":""},{"location":"openapi_first/binder/#openapi_first.binder-functions","title":"Functions","text":""},{"location":"openapi_first/binder/#openapi_first.binder.bind_routes","title":"bind_routes","text":"<pre><code>bind_routes(app: FastAPI, spec: Dict[str, Any], routes_module: Any) -&gt; None\n</code></pre> <p>Bind OpenAPI operations to FastAPI routes.</p> <p>Parameters:</p> Name Type Description Default <code>app</code> <code>FastAPI</code> <p>The FastAPI application instance to which routes will be added.</p> required <code>spec</code> <code>dict</code> <p>Parsed OpenAPI 3.x specification dictionary.</p> required <code>routes_module</code> <code>module</code> <p>Python module containing handler functions. Each handler's name MUST exactly match an OpenAPI operationId.</p> required <p>Raises:</p> Type Description <code>MissingOperationHandler</code> <p>If an operationId is missing from the spec or if no corresponding handler function exists in the routes module.</p> Notes <p>Responsibilities:</p> <pre><code>- 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</code></pre> <p>Guarantees:</p> <pre><code>- Route registration is deterministic and spec-driven. No route decorators are required or supported. Handler resolution errors surface at application startup.\n</code></pre>"},{"location":"openapi_first/cli/","title":"Cli","text":""},{"location":"openapi_first/cli/#openapi_first.cli","title":"openapi_first.cli","text":"<p>Command-line interface for FastAPI OpenAPI-first scaffolding utilities.</p>"},{"location":"openapi_first/cli/#openapi_first.cli--summary","title":"Summary","text":"<p>This CLI bootstraps OpenAPI-first FastAPI applications from versioned, bundled templates packaged with the library.</p>"},{"location":"openapi_first/cli/#openapi_first.cli-functions","title":"Functions","text":""},{"location":"openapi_first/cli/#openapi_first.cli.available_templates","title":"available_templates","text":"<pre><code>available_templates() -&gt; list[str]\n</code></pre> <p>Return a list of available application templates.</p> <p>Returns:</p> Type Description <code>list[str]</code> <p>list[str]: Sorted list of template names found in the internal templates directory.</p>"},{"location":"openapi_first/cli/#openapi_first.cli.copy_template","title":"copy_template","text":"<pre><code>copy_template(template: str, target_dir: Path) -&gt; None\n</code></pre> <p>Copy a bundled OpenAPI-first application template into a directory.</p> <p>Parameters:</p> Name Type Description Default <code>template</code> <code>str</code> <p>Name of the template to copy.</p> required <code>target_dir</code> <code>Path</code> <p>Filesystem path where the template should be copied.</p> required <p>Raises:</p> Type Description <code>FileNotFoundError</code> <p>If the requested template does not exist.</p>"},{"location":"openapi_first/client/","title":"Client","text":""},{"location":"openapi_first/client/#openapi_first.client","title":"openapi_first.client","text":"<p>OpenAPI-first HTTP client for contract-driven services.</p>"},{"location":"openapi_first/client/#openapi_first.client--summary","title":"Summary","text":"<p>This module provides <code>OpenAPIClient</code>, a thin, strict HTTP client that derives all callable operations directly from an OpenAPI 3.x specification.</p> <p>It is the client counterpart to <code>OpenAPIFirstApp</code>.</p> Notes <p>Core Principles:</p> <pre><code>- The OpenAPI specification is the single source of truth\n- Each operationId becomes a callable Python method\n- No implicit schema mutation or inference\n- No code generation step\n- Minimal abstraction over httpx\n</code></pre> <p>Responsibilities:</p> <pre><code>- Parses an OpenAPI 3.x specification\n- Dynamically creates one callable per operationId\n- Enforces presence of servers, paths, and operationId\n- Formats path parameters safely\n- Handles JSON request bodies explicitly\n- Returns raw `httpx.Response` objects\n</code></pre> <p>Constraints:</p> <pre><code>- This module intentionally does NOT: Generate client code, validate request/response schemas, deserialize responses, retry requests, implement authentication helpers, or assume non-2xx responses are failures.\n</code></pre>"},{"location":"openapi_first/client/#openapi_first.client-classes","title":"Classes","text":""},{"location":"openapi_first/client/#openapi_first.client.OpenAPIClient","title":"OpenAPIClient","text":"<pre><code>OpenAPIClient(spec: Dict[str, Any], base_url: Optional[str] = None, client: Optional[httpx.Client] = None)\n</code></pre> <p>OpenAPI-first HTTP client (httpx-based).</p> Notes <p>Responsibilities:</p> <pre><code>- This client derives all callable methods directly from an OpenAPI 3.x specification. Each operationId becomes a method on the client instance.\n</code></pre> <p>Guarantees:</p> <pre><code>- One callable per operationId\n- Explicit parameters (path, query, headers, body)\n- No implicit schema inference or mutation\n- Returns raw `httpx.Response` objects\n- No response validation or deserialization\n</code></pre> Example <pre><code>from openapi_first import loader, client\n\nspec = loader.load_openapi(\"openapi.yaml\")\n\napi = client.OpenAPIClient(\n spec=spec,\n base_url=\"http://localhost:8000\",\n)\n\n# Call operationId: getUser\nresponse = api.getUser(\n path_params={\"user_id\": 123}\n)\n\nprint(response.status_code)\nprint(response.json())\n</code></pre> <p>Initialize the OpenAPI client.</p> <p>Parameters:</p> Name Type Description Default <code>spec</code> <code>dict[str, Any]</code> <p>Parsed OpenAPI 3.x specification.</p> required <code>base_url</code> <code>str</code> <p>Base URL of the target service. If omitted, the first entry in the OpenAPI <code>servers</code> list is used.</p> <code>None</code> <code>client</code> <code>Client</code> <p>Optional preconfigured httpx client instance.</p> <code>None</code> <p>Raises:</p> Type Description <code>OpenAPIClientError</code> <p>If no servers are defined, spec has no paths, operationIds are missing/duplicate, or required parameters are missing.</p>"},{"location":"openapi_first/client/#openapi_first.client.OpenAPIClient-functions","title":"Functions","text":""},{"location":"openapi_first/client/#openapi_first.client.OpenAPIClientError","title":"OpenAPIClientError","text":"<p> Bases: <code>OpenAPIFirstError</code></p> <p>Raised when an OpenAPI client operation fails.</p>"},{"location":"openapi_first/errors/","title":"Errors","text":""},{"location":"openapi_first/errors/#openapi_first.errors","title":"openapi_first.errors","text":"<p>Exceptions for OpenAPI-first FastAPI applications.</p>"},{"location":"openapi_first/errors/#openapi_first.errors--summary","title":"Summary","text":"<p>This module defines a small hierarchy of explicit, intention-revealing exceptions used to signal contract violations between an OpenAPI specification and its Python implementation.</p> Notes <p>Design Principles:</p> <pre><code>- Errors represent programmer mistakes, not runtime conditions\n- All errors are raised during application startup\n- Messages are actionable and suitable for CI/CD output\n- Exceptions are explicit rather than reused from generic built-ins\n</code></pre> <p>These errors should normally cause immediate application failure.</p>"},{"location":"openapi_first/errors/#openapi_first.errors-classes","title":"Classes","text":""},{"location":"openapi_first/errors/#openapi_first.errors.MissingOperationHandler","title":"MissingOperationHandler","text":"<pre><code>MissingOperationHandler(*, path: str, method: str, operation_id: Optional[str] = None)\n</code></pre> <p> Bases: <code>OpenAPIFirstError</code></p> <p>Raised when an OpenAPI operation cannot be resolved to a handler.</p> Notes <p>Scenarios:</p> <pre><code>- An OpenAPI operation does not define an operationId\n- An operationId is defined but no matching function exists in the provided routes module\n</code></pre> <p>Guarantees:</p> <pre><code>- This represents a violation of the OpenAPI-first contract and indicates that the specification and implementation are out of sync\n</code></pre> <p>Initialize the error.</p> <p>Parameters:</p> Name Type Description Default <code>path</code> <code>str</code> <p>The HTTP path declared in the OpenAPI specification.</p> required <code>method</code> <code>str</code> <p>The HTTP method (as declared in the OpenAPI spec).</p> required <code>operation_id</code> <code>str</code> <p>The operationId declared in the OpenAPI spec, if present.</p> <code>None</code>"},{"location":"openapi_first/errors/#openapi_first.errors.MissingOperationHandler-functions","title":"Functions","text":""},{"location":"openapi_first/errors/#openapi_first.errors.OpenAPIFirstError","title":"OpenAPIFirstError","text":"<p> Bases: <code>Exception</code></p> <p>Base exception for all OpenAPI-first enforcement errors.</p> Notes <p>Responsibilities:</p> <pre><code>- This exception exists to allow callers, test suites, and CI pipelines to catch and distinguish OpenAPI contract violations from unrelated runtime errors\n- All exceptions raised by the OpenAPI-first core should inherit from this type\n</code></pre>"},{"location":"openapi_first/loader/","title":"Loader","text":""},{"location":"openapi_first/loader/#openapi_first.loader","title":"openapi_first.loader","text":"<p>OpenAPI specification loading and validation utilities.</p>"},{"location":"openapi_first/loader/#openapi_first.loader--summary","title":"Summary","text":"<p>This module is responsible for loading an OpenAPI 3.x specification from disk and validating it before it is used by the application.</p> <p>It enforces the principle that an invalid or malformed OpenAPI document must never reach the routing or runtime layers.</p> Notes <p>Design Principles:</p> <pre><code>- OpenAPI is treated as an authoritative contract\n- Invalid specifications fail fast at application startup\n- Supported formats are JSON and YAML\n- Validation errors are surfaced clearly and early\n</code></pre> <p>Constraints:</p> <pre><code>- This module intentionally does NOT: Modify the OpenAPI document, infer missing fields, generate models or code, or perform request/response validation at runtime.\n</code></pre>"},{"location":"openapi_first/loader/#openapi_first.loader-classes","title":"Classes","text":""},{"location":"openapi_first/loader/#openapi_first.loader.OpenAPISpecLoadError","title":"OpenAPISpecLoadError","text":"<p> Bases: <code>OpenAPIFirstError</code></p> <p>Raised when an OpenAPI specification cannot be loaded or validated.</p> Notes <p>Guarantees:</p> <pre><code>- This error indicates that the OpenAPI document is unreadable, malformed, or violates the OpenAPI 3.x specification\n</code></pre>"},{"location":"openapi_first/loader/#openapi_first.loader-functions","title":"Functions","text":""},{"location":"openapi_first/loader/#openapi_first.loader.load_openapi","title":"load_openapi","text":"<pre><code>load_openapi(path: Union[str, Path]) -&gt; Dict[str, Any]\n</code></pre> <p>Load and validate an OpenAPI 3.x specification from disk.</p> <p>Parameters:</p> Name Type Description Default <code>path</code> <code>str | Path</code> <p>Filesystem path to an OpenAPI specification file. Supported extensions: .json, .yaml, .yml.</p> required <p>Returns:</p> Type Description <code>Dict[str, Any]</code> <p>dict[str, Any]: Parsed and validated OpenAPI specification.</p> <p>Raises:</p> Type Description <code>OpenAPISpecLoadError</code> <p>If the file does not exist, cannot be parsed, or fails OpenAPI schema validation.</p> Notes <p>Guarantees:</p> <pre><code>- The specification is parsed based on file extension and validated using a strict OpenAPI schema validator\n- Any error results in an immediate exception, preventing application startup\n</code></pre>"},{"location":"openapi_first/templates/","title":"Templates","text":"<ul> <li>Crud App</li> <li>Health App</li> <li>Model App</li> </ul>"},{"location":"openapi_first/templates/#openapi_first.templates","title":"openapi_first.templates","text":"<p>Application templates for FastAPI OpenAPI First.</p> <p>This package contains example and scaffolding templates intended to be copied into user projects via the <code>openapi-first</code> CLI.</p> <p>Templates in this package are: - Reference implementations of OpenAPI-first services - Not part of the <code>openapi_first</code> public or internal API - Not intended to be imported as runtime dependencies</p> <p>The presence of this file exists solely to: - Mark the directory as an explicit Python package - Enable deterministic tooling behavior (documentation, packaging) - Avoid accidental traversal of non-package directories</p> <p>No code in this package should be imported by library consumers.</p>"},{"location":"openapi_first/templates/crud_app/","title":"Crud App","text":"<ul> <li>Data</li> <li>Main</li> <li>Routes</li> <li>Test Crud App</li> </ul>"},{"location":"openapi_first/templates/crud_app/#openapi_first.templates.crud_app","title":"openapi_first.templates.crud_app","text":"<p>OpenAPI-first CRUD application template.</p> <p>This package contains a complete, minimal example of an OpenAPI-first CRUD service built using the <code>openapi_first</code> library.</p> <p>The application is assembled exclusively from: - an OpenAPI specification (<code>openapi.yaml</code>) - a handler namespace implementing CRUD operations (<code>routes</code>) - an in-memory mock data store (<code>data</code>)</p> <p>All HTTP routes, methods, schemas, and operation bindings are defined in the OpenAPI specification and enforced at application startup. No decorator-driven routing or implicit framework behavior is used.</p> <p>This template demonstrates: - operationId-driven server-side route binding - explicit HTTP status code control in handlers - operationId-driven client usage against the same OpenAPI contract - end-to-end validation using in-memory data and tests</p>"},{"location":"openapi_first/templates/crud_app/#openapi_first.templates.crud_app--scaffolding-via-cli","title":"Scaffolding via CLI","text":"<p>Create a new CRUD example service using the bundled template:</p> <pre><code>openapi-first crud_app\n</code></pre> <p>Create the service in a custom directory:</p> <pre><code>openapi-first crud_app my-crud-service\n</code></pre> <p>List all available application templates:</p> <pre><code>openapi-first --list\n</code></pre> <p>The CLI copies template files verbatim into the target directory. No code is generated or modified beyond the copied scaffold.</p>"},{"location":"openapi_first/templates/crud_app/#openapi_first.templates.crud_app--client-usage-example","title":"Client Usage Example","text":"<p>The same OpenAPI specification used by the server can be used to construct a strict, operationId-driven HTTP client.</p> <p>Example client calls for CRUD operations:</p> <pre><code>from openapi_first.loader import load_openapi\nfrom openapi_first.client import OpenAPIClient\n\nspec = load_openapi(\"openapi.yaml\")\nclient = OpenAPIClient(spec)\n\n# List items\nresponse = client.list_items()\n\n# Get item by ID\nresponse = client.get_item(\n path_params={\"item_id\": 1}\n)\n\n# Create item\nresponse = client.create_item(\n body={\"name\": \"Orange\", \"price\": 0.8}\n)\n\n# Update item\nresponse = client.update_item(\n path_params={\"item_id\": 1},\n body={\"name\": \"Green Apple\", \"price\": 0.6},\n)\n\n# Delete item\nresponse = client.delete_item(\n path_params={\"item_id\": 1}\n)\n</code></pre> <p>Client guarantees: - One callable per OpenAPI <code>operationId</code> - No hardcoded URLs or HTTP methods in user code - Path and request parameters must match the OpenAPI specification - Invalid or incomplete OpenAPI specs fail at client construction time</p>"},{"location":"openapi_first/templates/crud_app/#openapi_first.templates.crud_app--non-goals","title":"Non-Goals","text":"<p>This template is intentionally minimal and is NOT: - production-ready - persistent or concurrency-safe - a reference architecture for data storage</p> <p>It exists solely as a copyable example for learning, testing, and bootstrapping OpenAPI-first services.</p> <p>This package is not part of the <code>openapi_first</code> library API surface.</p>"},{"location":"openapi_first/templates/crud_app/data/","title":"Data","text":""},{"location":"openapi_first/templates/crud_app/data/#openapi_first.templates.crud_app.data","title":"openapi_first.templates.crud_app.data","text":"<p>In-memory mock data store for CRUD example.</p> <p>This module intentionally avoids persistence and concurrency guarantees. It is suitable for demos, tests, and scaffolding only.</p> <p>It intentionally avoids - persistence - concurrency guarantees - validation - error handling</p> <p>The implementation is suitable for: - demonstrations - tests - scaffolding and example services</p> <p>It is explicitly NOT suitable for production use.</p> <p>This module is not part of the <code>openapi_first</code> library API surface.</p>"},{"location":"openapi_first/templates/crud_app/data/#openapi_first.templates.crud_app.data-functions","title":"Functions","text":""},{"location":"openapi_first/templates/crud_app/data/#openapi_first.templates.crud_app.data.create_item","title":"create_item","text":"<pre><code>create_item(payload: dict)\n</code></pre> <p>Create a new item in the data store.</p> <p>A new integer ID is assigned automatically. No validation is performed on the provided payload.</p>"},{"location":"openapi_first/templates/crud_app/data/#openapi_first.templates.crud_app.data.create_item--parameters","title":"Parameters","text":"<p>payload : dict Item attributes excluding the <code>id</code> field.</p>"},{"location":"openapi_first/templates/crud_app/data/#openapi_first.templates.crud_app.data.create_item--returns","title":"Returns","text":"<p>dict The newly created item, including its assigned ID.</p>"},{"location":"openapi_first/templates/crud_app/data/#openapi_first.templates.crud_app.data.delete_item","title":"delete_item","text":"<pre><code>delete_item(item_id: int)\n</code></pre> <p>Remove an item from the data store.</p> <p>This function assumes the item exists and will raise <code>KeyError</code> if the ID is not present.</p>"},{"location":"openapi_first/templates/crud_app/data/#openapi_first.templates.crud_app.data.delete_item--parameters","title":"Parameters","text":"<p>item_id : int Identifier of the item to delete.</p>"},{"location":"openapi_first/templates/crud_app/data/#openapi_first.templates.crud_app.data.get_item","title":"get_item","text":"<pre><code>get_item(item_id: int)\n</code></pre> <p>Retrieve a single item by ID.</p> <p>This function assumes the item exists and will raise <code>KeyError</code> if the ID is not present in the store.</p>"},{"location":"openapi_first/templates/crud_app/data/#openapi_first.templates.crud_app.data.get_item--parameters","title":"Parameters","text":"<p>item_id : int Identifier of the item to retrieve.</p>"},{"location":"openapi_first/templates/crud_app/data/#openapi_first.templates.crud_app.data.get_item--returns","title":"Returns","text":"<p>dict The stored item representation.</p>"},{"location":"openapi_first/templates/crud_app/data/#openapi_first.templates.crud_app.data.list_items","title":"list_items","text":"<pre><code>list_items()\n</code></pre> <p>Return all items in the data store.</p> <p>This function performs no filtering, pagination, or sorting. The returned collection reflects the current in-memory state.</p>"},{"location":"openapi_first/templates/crud_app/data/#openapi_first.templates.crud_app.data.list_items--returns","title":"Returns","text":"<p>list[dict] A list of item representations.</p>"},{"location":"openapi_first/templates/crud_app/data/#openapi_first.templates.crud_app.data.update_item","title":"update_item","text":"<pre><code>update_item(item_id: int, payload: dict)\n</code></pre> <p>Replace an existing item in the data store.</p> <p>This function overwrites the existing item entirely and does not perform partial updates or validation. If the item does not exist, it will be created implicitly.</p>"},{"location":"openapi_first/templates/crud_app/data/#openapi_first.templates.crud_app.data.update_item--parameters","title":"Parameters","text":"<p>item_id : int Identifier of the item to update. payload : dict Item attributes excluding the <code>id</code> field.</p>"},{"location":"openapi_first/templates/crud_app/data/#openapi_first.templates.crud_app.data.update_item--returns","title":"Returns","text":"<p>dict The updated item representation.</p>"},{"location":"openapi_first/templates/crud_app/main/","title":"Main","text":""},{"location":"openapi_first/templates/crud_app/main/#openapi_first.templates.crud_app.main","title":"openapi_first.templates.crud_app.main","text":"<p>Application entry point for an OpenAPI-first CRUD example service.</p> <p>This module constructs a FastAPI application exclusively from an OpenAPI specification and a handler namespace, without using decorator-driven routing.</p> <p>All HTTP routes, methods, request/response schemas, and operation bindings are defined in the OpenAPI document referenced by <code>openapi_path</code>. Python callables defined in the <code>routes</code> module are bound to OpenAPI operations strictly via <code>operationId</code>.</p> <p>This module contains no routing logic, persistence concerns, or framework configuration beyond application assembly.</p> <p>Design guarantees: - OpenAPI is the single source of truth - No undocumented routes can exist - Every OpenAPI operationId must resolve to exactly one handler - All contract violations fail at application startup</p> <p>This file is intended to be used as the ASGI entry point.</p> Example <p>uvicorn main:app</p>"},{"location":"openapi_first/templates/crud_app/main/#openapi_first.templates.crud_app.main-classes","title":"Classes","text":""},{"location":"openapi_first/templates/crud_app/routes/","title":"Routes","text":""},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes","title":"openapi_first.templates.crud_app.routes","text":"<p>CRUD route handlers bound via OpenAPI operationId.</p> <p>These handlers explicitly control HTTP status codes to ensure runtime behavior matches the OpenAPI contract.</p> <p>This module defines OpenAPI-bound operation handlers for a simple CRUD service. Functions in this module are bound to HTTP routes exclusively via OpenAPI <code>operationId</code> values.</p> <p>Handlers explicitly control HTTP response status codes to ensure runtime behavior matches the OpenAPI contract. Error conditions are translated into explicit HTTP responses rather than relying on implicit framework behavior.</p> <p>No routing decorators or path definitions appear in this module. All routing, HTTP methods, and schemas are defined in the OpenAPI specification.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes-functions","title":"Functions","text":""},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.create_item","title":"create_item","text":"<pre><code>create_item(payload: dict, response: Response)\n</code></pre> <p>Create a new item.</p> <p>Implements the OpenAPI operation identified by <code>operationId: create_item</code>.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.create_item--parameters","title":"Parameters","text":"<p>payload : dict Item attributes excluding the <code>id</code> field. response : fastapi.Response Response object used to set the HTTP status code.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.create_item--returns","title":"Returns","text":"<p>dict The newly created item.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.delete_item","title":"delete_item","text":"<pre><code>delete_item(item_id: int, response: Response)\n</code></pre> <p>Delete an existing item.</p> <p>Implements the OpenAPI operation identified by <code>operationId: delete_item</code>.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.delete_item--parameters","title":"Parameters","text":"<p>item_id : int Identifier of the item to delete. response : fastapi.Response Response object used to set the HTTP status code.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.delete_item--returns","title":"Returns","text":"<p>None No content.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.delete_item--raises","title":"Raises","text":"<p>HTTPException 404 if the item does not exist.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.get_item","title":"get_item","text":"<pre><code>get_item(item_id: int)\n</code></pre> <p>Retrieve a single item by ID.</p> <p>Implements the OpenAPI operation identified by <code>operationId: get_item</code>.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.get_item--parameters","title":"Parameters","text":"<p>item_id : int Identifier of the item to retrieve.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.get_item--returns","title":"Returns","text":"<p>dict The requested item.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.get_item--raises","title":"Raises","text":"<p>HTTPException 404 if the item does not exist.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.list_items","title":"list_items","text":"<pre><code>list_items()\n</code></pre> <p>List all items.</p> <p>Implements the OpenAPI operation identified by <code>operationId: list_items</code>.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.list_items--returns","title":"Returns","text":"<p>list[dict] A list of item representations.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.update_item","title":"update_item","text":"<pre><code>update_item(item_id: int, payload: dict)\n</code></pre> <p>Update an existing item.</p> <p>Implements the OpenAPI operation identified by <code>operationId: update_item</code>.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.update_item--parameters","title":"Parameters","text":"<p>item_id : int Identifier of the item to update. payload : dict Item attributes excluding the <code>id</code> field.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.update_item--returns","title":"Returns","text":"<p>dict The updated item.</p>"},{"location":"openapi_first/templates/crud_app/routes/#openapi_first.templates.crud_app.routes.update_item--raises","title":"Raises","text":"<p>HTTPException 404 if the item does not exist.</p>"},{"location":"openapi_first/templates/crud_app/test_crud_app/","title":"Test Crud App","text":""},{"location":"openapi_first/templates/crud_app/test_crud_app/#openapi_first.templates.crud_app.test_crud_app","title":"openapi_first.templates.crud_app.test_crud_app","text":"<p>End-to-end tests for the OpenAPI-first CRUD example app.</p> <p>These tests validate that all CRUD operations behave correctly against the in-memory mock data store. - OpenAPI specification loading - OperationId-driven route binding on the server - OperationId-driven client invocation - Correct HTTP status codes and response payloads</p> <p>The tests exercise all CRUD operations against an in-memory mock data store and assume deterministic behavior within a single process.</p> <p>The tests assume: - OpenAPI-first route binding - In-memory storage (no persistence guarantees) - Deterministic behavior in a single process - One-to-one correspondence between OpenAPI operationId values and server/client callables</p>"},{"location":"openapi_first/templates/crud_app/test_crud_app/#openapi_first.templates.crud_app.test_crud_app-classes","title":"Classes","text":""},{"location":"openapi_first/templates/crud_app/test_crud_app/#openapi_first.templates.crud_app.test_crud_app-functions","title":"Functions","text":""},{"location":"openapi_first/templates/crud_app/test_crud_app/#openapi_first.templates.crud_app.test_crud_app.test_create_item","title":"test_create_item","text":"<pre><code>test_create_item()\n</code></pre> <p>Creating a new item should return the created entity.</p>"},{"location":"openapi_first/templates/crud_app/test_crud_app/#openapi_first.templates.crud_app.test_crud_app.test_delete_item","title":"test_delete_item","text":"<pre><code>test_delete_item()\n</code></pre> <p>Deleting an item should remove it from the store.</p>"},{"location":"openapi_first/templates/crud_app/test_crud_app/#openapi_first.templates.crud_app.test_crud_app.test_get_item","title":"test_get_item","text":"<pre><code>test_get_item()\n</code></pre> <p>Existing item should be retrievable by ID.</p>"},{"location":"openapi_first/templates/crud_app/test_crud_app/#openapi_first.templates.crud_app.test_crud_app.test_list_items_initial","title":"test_list_items_initial","text":"<pre><code>test_list_items_initial()\n</code></pre> <p>Initial items should be present.</p>"},{"location":"openapi_first/templates/crud_app/test_crud_app/#openapi_first.templates.crud_app.test_crud_app.test_update_item","title":"test_update_item","text":"<pre><code>test_update_item()\n</code></pre> <p>Updating an item should replace its values.</p>"},{"location":"openapi_first/templates/health_app/","title":"Health App","text":"<ul> <li>Main</li> <li>Routes</li> </ul>"},{"location":"openapi_first/templates/health_app/#openapi_first.templates.health_app","title":"openapi_first.templates.health_app","text":"<p>OpenAPI-first FastAPI application template.</p> <p>This package contains a minimal, fully working example of an OpenAPI-first FastAPI service built using the <code>openapi_first</code> library.</p> <p>The application is assembled exclusively from: - an OpenAPI specification (<code>openapi.yaml</code>) - a handler namespace (<code>routes</code>)</p> <p>No routing decorators, implicit behavior, or framework-specific convenience abstractions are used. All HTTP routes, methods, and operation bindings are defined in OpenAPI and enforced at application startup.</p> <p>This package is intended to be copied as a starting point for new services via the <code>openapi-first</code> CLI. It is not part of the <code>openapi_first</code> library API surface.</p>"},{"location":"openapi_first/templates/health_app/#openapi_first.templates.health_app--scaffolding-via-cli","title":"Scaffolding via CLI","text":"<p>Create a new OpenAPI-first health check service using the bundled template:</p> <pre><code>openapi-first health_app\n</code></pre> <p>Create the service in a custom directory:</p> <pre><code>openapi-first health_app my-health-service\n</code></pre> <p>List all available application templates:</p> <pre><code>openapi-first --list\n</code></pre> <p>The CLI copies template files verbatim into the target directory. No code is generated or modified beyond the copied scaffold.</p>"},{"location":"openapi_first/templates/health_app/#openapi_first.templates.health_app--client-usage-example","title":"Client Usage Example","text":"<p>The same OpenAPI specification used by the server can be used to construct a strict, operationId-driven HTTP client.</p> <p>Example client call for the <code>get_health</code> operation:</p> <pre><code>from openapi_first.loader import load_openapi\nfrom openapi_first.client import OpenAPIClient\n\nspec = load_openapi(\"openapi.yaml\")\nclient = OpenAPIClient(spec)\n\nresponse = client.get_health()\n\nassert response.status_code == 200\nassert response.json() == {\"status\": \"ok\"}\n</code></pre> <p>Client guarantees: - One callable per OpenAPI <code>operationId</code> - No hardcoded URLs or HTTP methods in user code - Path and request parameters must match the OpenAPI specification - Invalid or incomplete OpenAPI specs fail at client construction time</p>"},{"location":"openapi_first/templates/health_app/main/","title":"Main","text":""},{"location":"openapi_first/templates/health_app/main/#openapi_first.templates.health_app.main","title":"openapi_first.templates.health_app.main","text":"<p>Application entry point for an OpenAPI-first FastAPI service.</p> <p>This module constructs a FastAPI application exclusively from an OpenAPI specification and a handler namespace, without using decorator-driven routing.</p> <p>All HTTP routes, methods, and operation bindings are defined in the OpenAPI document referenced by <code>openapi_path</code>. Python callables defined in the <code>routes</code> module are bound to OpenAPI operations strictly via <code>operationId</code>.</p> <p>This module contains no routing logic, request handling, or framework configuration beyond application assembly.</p> <p>Design guarantees: - OpenAPI is the single source of truth - No undocumented routes can exist - Every OpenAPI operationId must resolve to exactly one handler - All contract violations fail at application startup</p> <p>This file is intended to be used as the ASGI entry point.</p> Example <p>uvicorn main:app</p>"},{"location":"openapi_first/templates/health_app/main/#openapi_first.templates.health_app.main-classes","title":"Classes","text":""},{"location":"openapi_first/templates/health_app/routes/","title":"Routes","text":""},{"location":"openapi_first/templates/health_app/routes/#openapi_first.templates.health_app.routes","title":"openapi_first.templates.health_app.routes","text":"<p>OpenAPI operation handlers.</p> <p>This module defines pure Python callables that implement OpenAPI operations for this service. Functions in this module are bound to HTTP routes exclusively via OpenAPI <code>operationId</code> values.</p> <p>No routing decorators, HTTP metadata, or framework-specific logic should appear here. All request/response semantics are defined in the OpenAPI specification.</p> <p>This module serves solely as an operationId namespace.</p>"},{"location":"openapi_first/templates/health_app/routes/#openapi_first.templates.health_app.routes-functions","title":"Functions","text":""},{"location":"openapi_first/templates/health_app/routes/#openapi_first.templates.health_app.routes.get_health","title":"get_health","text":"<pre><code>get_health()\n</code></pre> <p>Health check operation handler.</p> <p>This function implements the OpenAPI operation identified by <code>operationId: get_health</code>.</p> <p>It contains no routing metadata or framework-specific logic. Request binding, HTTP method, and response semantics are defined exclusively by the OpenAPI specification.</p>"},{"location":"openapi_first/templates/health_app/routes/#openapi_first.templates.health_app.routes.get_health--returns","title":"Returns","text":"<p>dict A minimal liveness payload indicating service health.</p>"},{"location":"openapi_first/templates/model_app/","title":"Model App","text":"<ul> <li>Data</li> <li>Main</li> <li>Models</li> <li>Routes</li> <li>Test Model App</li> </ul>"},{"location":"openapi_first/templates/model_app/#openapi_first.templates.model_app","title":"openapi_first.templates.model_app","text":"<p>OpenAPI-first model-based CRUD application template.</p> <p>This package contains a complete, minimal example of an OpenAPI-first CRUD service that uses explicit Pydantic domain models for request and response schemas.</p> <p>The application is assembled exclusively from: - an OpenAPI specification (<code>openapi.yaml</code>) - a handler namespace implementing CRUD operations (<code>routes</code>) - Pydantic domain models (<code>models</code>) - an in-memory mock data store (<code>data</code>)</p> <p>All HTTP routes, methods, schemas, and operation bindings are defined in the OpenAPI specification and enforced at application startup. No decorator-driven routing or implicit framework behavior is used.</p> <p>This template demonstrates: - operationId-driven server-side route binding - explicit request and response modeling with Pydantic - explicit HTTP status code control in handlers - operationId-driven client usage against the same OpenAPI contract - end-to-end validation using in-memory data and tests</p>"},{"location":"openapi_first/templates/model_app/#openapi_first.templates.model_app--scaffolding-via-cli","title":"Scaffolding via CLI","text":"<p>Create a new model-based CRUD example service using the bundled template:</p> <pre><code>openapi-first model_app\n</code></pre> <p>Create the service in a custom directory:</p> <pre><code>openapi-first model_app my-model-service\n</code></pre> <p>List all available application templates:</p> <pre><code>openapi-first --list\n</code></pre> <p>The CLI copies template files verbatim into the target directory. No code is generated or modified beyond the copied scaffold.</p>"},{"location":"openapi_first/templates/model_app/#openapi_first.templates.model_app--client-usage-example","title":"Client Usage Example","text":"<p>The same OpenAPI specification used by the server can be used to construct a strict, operationId-driven HTTP client.</p> <p>Example client calls for model-based CRUD operations:</p> <pre><code>from openapi_first.loader import load_openapi\nfrom openapi_first.client import OpenAPIClient\n\nspec = load_openapi(\"openapi.yaml\")\nclient = OpenAPIClient(spec)\n\n# List items\nresponse = client.list_items()\n\n# Get item by ID\nresponse = client.get_item(\n path_params={\"item_id\": 1}\n)\n\n# Create item\nresponse = client.create_item(\n body={\"name\": \"Orange\", \"price\": 0.8}\n)\n\n# Update item\nresponse = client.update_item(\n path_params={\"item_id\": 1},\n body={\"name\": \"Green Apple\", \"price\": 0.6},\n)\n\n# Delete item\nresponse = client.delete_item(\n path_params={\"item_id\": 1}\n)\n</code></pre> <p>Client guarantees: - One callable per OpenAPI <code>operationId</code> - No hardcoded URLs or HTTP methods in user code - Request and response payloads conform to Pydantic models - Invalid or incomplete OpenAPI specs fail at client construction time</p>"},{"location":"openapi_first/templates/model_app/#openapi_first.templates.model_app--non-goals","title":"Non-Goals","text":"<p>This template is intentionally minimal and is NOT: - production-ready - persistent or concurrency-safe - a reference architecture for data storage</p> <p>It exists solely as a copyable example for learning, testing, and bootstrapping OpenAPI-first services.</p> <p>This package is not part of the <code>openapi_first</code> library API surface.</p>"},{"location":"openapi_first/templates/model_app/data/","title":"Data","text":""},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data","title":"openapi_first.templates.model_app.data","text":"<p>In-memory data store using Pydantic models.</p> <p>This module is NOT thread-safe and is intended for demos and scaffolds only. This module provides a minimal, process-local data store for the model-based CRUD example application. It stores and returns domain objects defined using Pydantic models and is intended solely for demonstration and scaffolding purposes.</p> <p>The implementation intentionally avoids: - persistence - concurrency guarantees - transactional semantics - validation beyond what Pydantic provides</p> <p>It is not part of the <code>openapi_first</code> library API surface.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data-functions","title":"Functions","text":""},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.create_item","title":"create_item","text":"<pre><code>create_item(payload: ItemCreate) -&gt; Item\n</code></pre> <p>Create a new item in the data store.</p> <p>A new identifier is assigned automatically. No additional validation is performed beyond Pydantic model validation.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.create_item--parameters","title":"Parameters","text":"<p>payload : ItemCreate Data required to create a new item.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.create_item--returns","title":"Returns","text":"<p>Item The newly created item.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.delete_item","title":"delete_item","text":"<pre><code>delete_item(item_id: int) -&gt; None\n</code></pre> <p>Remove an item from the data store.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.delete_item--parameters","title":"Parameters","text":"<p>item_id : int Identifier of the item to delete.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.delete_item--raises","title":"Raises","text":"<p>KeyError If the item does not exist.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.get_item","title":"get_item","text":"<pre><code>get_item(item_id: int) -&gt; Item\n</code></pre> <p>Retrieve a single item by ID.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.get_item--parameters","title":"Parameters","text":"<p>item_id : int Identifier of the item to retrieve.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.get_item--returns","title":"Returns","text":"<p>Item The requested item.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.get_item--raises","title":"Raises","text":"<p>KeyError If the item does not exist.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.list_items","title":"list_items","text":"<pre><code>list_items() -&gt; list[Item]\n</code></pre> <p>Return all items in the data store.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.list_items--returns","title":"Returns","text":"<p>list[Item] A list of item domain objects.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.update_item","title":"update_item","text":"<pre><code>update_item(item_id: int, payload: ItemCreate) -&gt; Item\n</code></pre> <p>Replace an existing item in the data store.</p> <p>This function performs a full replacement of the stored item. Partial updates are not supported.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.update_item--parameters","title":"Parameters","text":"<p>item_id : int Identifier of the item to update. payload : ItemCreate New item data.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.update_item--returns","title":"Returns","text":"<p>Item The updated item.</p>"},{"location":"openapi_first/templates/model_app/data/#openapi_first.templates.model_app.data.update_item--raises","title":"Raises","text":"<p>KeyError If the item does not exist.</p>"},{"location":"openapi_first/templates/model_app/main/","title":"Main","text":""},{"location":"openapi_first/templates/model_app/main/#openapi_first.templates.model_app.main","title":"openapi_first.templates.model_app.main","text":"<p>Application entry point for an OpenAPI-first model-based CRUD example service.</p> <p>This module constructs a FastAPI application exclusively from an OpenAPI specification and a handler namespace, without using decorator-driven routing.</p> <p>All HTTP routes, methods, request/response schemas, and operation bindings are defined in the OpenAPI document referenced by <code>openapi_path</code>. Python callables defined in the <code>routes</code> module are bound to OpenAPI operations strictly via <code>operationId</code>.</p> <p>This module contains no routing logic, persistence concerns, or framework configuration beyond application assembly.</p> <p>Design guarantees: - OpenAPI is the single source of truth - No undocumented routes can exist - Every OpenAPI operationId must resolve to exactly one handler - All contract violations fail at application startup</p> <p>This file is intended to be used as the ASGI entry point.</p> Example <p>uvicorn main:app</p>"},{"location":"openapi_first/templates/model_app/main/#openapi_first.templates.model_app.main-classes","title":"Classes","text":""},{"location":"openapi_first/templates/model_app/models/","title":"Models","text":""},{"location":"openapi_first/templates/model_app/models/#openapi_first.templates.model_app.models","title":"openapi_first.templates.model_app.models","text":"<p>Pydantic domain models for the CRUD example.</p> <p>This module defines Pydantic models that represent the domain entities used by the service. These models are referenced by the OpenAPI specification for request and response schemas.</p> <p>The models are declarative and framework-agnostic. They contain no persistence logic, validation beyond type constraints, or business behavior.</p> <p>This module is not part of the <code>openapi_first</code> library API surface. It exists solely to support the example application template.</p>"},{"location":"openapi_first/templates/model_app/models/#openapi_first.templates.model_app.models-classes","title":"Classes","text":""},{"location":"openapi_first/templates/model_app/models/#openapi_first.templates.model_app.models.Item","title":"Item","text":"<p> Bases: <code>ItemBase</code></p> <p>Domain model for a persisted item.</p> <p>This model represents the full item state returned in responses, including the server-assigned identifier.</p>"},{"location":"openapi_first/templates/model_app/models/#openapi_first.templates.model_app.models.ItemBase","title":"ItemBase","text":"<p> Bases: <code>BaseModel</code></p> <p>Base domain model for an item.</p> <p>Defines fields common to all item representations.</p>"},{"location":"openapi_first/templates/model_app/models/#openapi_first.templates.model_app.models.ItemCreate","title":"ItemCreate","text":"<p> Bases: <code>ItemBase</code></p> <p>Domain model for item creation requests.</p> <p>This model is used for request bodies when creating new items. It intentionally excludes the <code>id</code> field, which is assigned by the service.</p>"},{"location":"openapi_first/templates/model_app/routes/","title":"Routes","text":""},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes","title":"openapi_first.templates.model_app.routes","text":"<p>CRUD route handlers bound via OpenAPI operationId.</p> <p>This module defines OpenAPI-bound operation handlers for a model-based CRUD service. Functions in this module are bound to HTTP routes exclusively via OpenAPI <code>operationId</code> values.</p> <p>Handlers explicitly control HTTP response status codes to ensure runtime behavior matches the OpenAPI contract. Domain models defined using Pydantic are used for request and response payloads.</p> <p>No routing decorators, path definitions, or implicit framework behavior appear in this module. All routing, HTTP methods, and schemas are defined in the OpenAPI specification.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes-functions","title":"Functions","text":""},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.create_item","title":"create_item","text":"<pre><code>create_item(payload: ItemCreate, response: Response)\n</code></pre> <p>Create a new item.</p> <p>Implements the OpenAPI operation identified by <code>operationId: create_item</code>.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.create_item--parameters","title":"Parameters","text":"<p>payload : ItemCreate Request body describing the item to create. response : fastapi.Response Response object used to set the HTTP status code.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.create_item--returns","title":"Returns","text":"<p>Item The newly created item.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.delete_item","title":"delete_item","text":"<pre><code>delete_item(item_id: int, response: Response)\n</code></pre> <p>Delete an existing item.</p> <p>Implements the OpenAPI operation identified by <code>operationId: delete_item</code>.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.delete_item--parameters","title":"Parameters","text":"<p>item_id : int Identifier of the item to delete. response : fastapi.Response Response object used to set the HTTP status code.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.delete_item--returns","title":"Returns","text":"<p>None No content.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.delete_item--raises","title":"Raises","text":"<p>HTTPException 404 if the item does not exist.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.get_item","title":"get_item","text":"<pre><code>get_item(item_id: int)\n</code></pre> <p>Retrieve a single item by ID.</p> <p>Implements the OpenAPI operation identified by <code>operationId: get_item</code>.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.get_item--parameters","title":"Parameters","text":"<p>item_id : int Identifier of the item to retrieve.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.get_item--returns","title":"Returns","text":"<p>Item The requested item.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.get_item--raises","title":"Raises","text":"<p>HTTPException 404 if the item does not exist.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.list_items","title":"list_items","text":"<pre><code>list_items()\n</code></pre> <p>List all items.</p> <p>Implements the OpenAPI operation identified by <code>operationId: list_items</code>.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.list_items--returns","title":"Returns","text":"<p>list[Item] A list of item domain objects.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.update_item","title":"update_item","text":"<pre><code>update_item(item_id: int, payload: ItemCreate)\n</code></pre> <p>Update an existing item.</p> <p>Implements the OpenAPI operation identified by <code>operationId: update_item</code>.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.update_item--parameters","title":"Parameters","text":"<p>item_id : int Identifier of the item to update. payload : ItemCreate New item data.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.update_item--returns","title":"Returns","text":"<p>Item The updated item.</p>"},{"location":"openapi_first/templates/model_app/routes/#openapi_first.templates.model_app.routes.update_item--raises","title":"Raises","text":"<p>HTTPException 404 if the item does not exist.</p>"},{"location":"openapi_first/templates/model_app/test_model_app/","title":"Test Model App","text":""},{"location":"openapi_first/templates/model_app/test_model_app/#openapi_first.templates.model_app.test_model_app","title":"openapi_first.templates.model_app.test_model_app","text":"<p>End-to-end tests for the OpenAPI-first model CRUD example app.</p> <p>These tests validate that all CRUD operations behave correctly against the in-memory mock data store using Pydantic models. - OpenAPI specification loading - OperationId-driven route binding on the server - OperationId-driven client invocation - Pydantic model-based request and response handling</p> <p>All CRUD operations are exercised against an in-memory mock data store backed by Pydantic domain models.</p> <p>The tests assume: - OpenAPI-first route binding - Pydantic model validation - In-memory storage (no persistence guarantees) - Deterministic behavior in a single process</p>"},{"location":"openapi_first/templates/model_app/test_model_app/#openapi_first.templates.model_app.test_model_app-classes","title":"Classes","text":""},{"location":"openapi_first/templates/model_app/test_model_app/#openapi_first.templates.model_app.test_model_app-functions","title":"Functions","text":""},{"location":"openapi_first/templates/model_app/test_model_app/#openapi_first.templates.model_app.test_model_app.test_create_item","title":"test_create_item","text":"<pre><code>test_create_item()\n</code></pre> <p>Creating a new item should return the created entity.</p>"},{"location":"openapi_first/templates/model_app/test_model_app/#openapi_first.templates.model_app.test_model_app.test_delete_item","title":"test_delete_item","text":"<pre><code>test_delete_item()\n</code></pre> <p>Deleting an item should remove it from the store.</p>"},{"location":"openapi_first/templates/model_app/test_model_app/#openapi_first.templates.model_app.test_model_app.test_get_item","title":"test_get_item","text":"<pre><code>test_get_item()\n</code></pre> <p>Existing item should be retrievable by ID.</p>"},{"location":"openapi_first/templates/model_app/test_model_app/#openapi_first.templates.model_app.test_model_app.test_list_items_initial","title":"test_list_items_initial","text":"<pre><code>test_list_items_initial()\n</code></pre> <p>Initial items should be present.</p>"},{"location":"openapi_first/templates/model_app/test_model_app/#openapi_first.templates.model_app.test_model_app.test_update_item","title":"test_update_item","text":"<pre><code>test_update_item()\n</code></pre> <p>Updating an item should replace its values.</p>"}]}