This commit is contained in:
@@ -740,12 +740,11 @@
|
||||
|
||||
<div class="doc doc-contents first">
|
||||
|
||||
<p>OpenAPI-driven route binding for FastAPI.</p>
|
||||
<hr />
|
||||
<h4 id="openapi_first.binder--summary">Summary</h4>
|
||||
<h3 id="openapi_first.binder--summary">Summary</h3>
|
||||
<p>OpenAPI-driven route binding for FastAPI.</p>
|
||||
<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>
|
||||
between OpenAPI operations and Python handler functions using <code>operationId</code>.</p>
|
||||
|
||||
|
||||
<details class="notes" open>
|
||||
@@ -754,24 +753,32 @@ between OpenAPI operations and Python handler functions using operationId.</p>
|
||||
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
|
||||
<span class="normal">2</span>
|
||||
<span class="normal">3</span>
|
||||
<span class="normal">4</span></pre></div></td><td class="code"><div><pre><span></span><code>- Read path + method definitions from an OpenAPI specification
|
||||
- Resolve each operationId to a Python callable
|
||||
- Register routes with FastAPI using APIRoute
|
||||
- Fail fast when contract violations are detected
|
||||
<span class="normal">4</span></pre></div></td><td class="code"><div><pre><span></span><code>- Read path + method definitions from an OpenAPI specification.
|
||||
- Resolve each `operationId` to a Python callable.
|
||||
- Register routes with FastAPI using `APIRoute`.
|
||||
- Fail fast when contract violations are detected.
|
||||
</code></pre></div></td></tr></table></div>
|
||||
<p><strong>Design Constraints:</strong></p>
|
||||
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
|
||||
<span class="normal">2</span>
|
||||
<span class="normal">3</span>
|
||||
<span class="normal">4</span>
|
||||
<span class="normal">5</span></pre></div></td><td class="code"><div><pre><span></span><code>- All routes MUST be declared in the OpenAPI specification
|
||||
- All OpenAPI operations MUST define an operationId
|
||||
- Every operationId MUST resolve to a handler function
|
||||
- Handlers are plain Python callables (no decorators required)
|
||||
- No implicit route creation or inference is allowed
|
||||
<span class="normal">5</span></pre></div></td><td class="code"><div><pre><span></span><code>- All routes MUST be declared in the OpenAPI specification.
|
||||
- All OpenAPI operations MUST define an `operationId`.
|
||||
- Every `operationId` MUST resolve to a handler function.
|
||||
- Handlers are plain Python callables (no decorators required).
|
||||
- No implicit route creation or inference is allowed.
|
||||
</code></pre></div></td></tr></table></div>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><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.
|
||||
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
|
||||
<span class="normal">2</span>
|
||||
<span class="normal">3</span>
|
||||
<span class="normal">4</span>
|
||||
<span class="normal">5</span></pre></div></td><td class="code"><div><pre><span></span><code>- This module intentionally does NOT:
|
||||
- Perform request or response validation.
|
||||
- Generate Pydantic models.
|
||||
- Modify FastAPI dependency injection.
|
||||
- Interpret OpenAPI semantics beyond routing metadata.
|
||||
</code></pre></div></td></tr></table></div>
|
||||
</details>
|
||||
|
||||
@@ -848,7 +855,8 @@ between OpenAPI operations and Python handler functions using operationId.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>Python module containing handler functions. Each handler's name MUST exactly match an OpenAPI operationId.</p>
|
||||
<p>Python module containing handler functions. Each handler's name MUST
|
||||
exactly match an OpenAPI <code>operationId</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
@@ -870,11 +878,12 @@ between OpenAPI operations and Python handler functions using operationId.</p>
|
||||
<tbody>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-internal" title="openapi_first.errors.MissingOperationHandler" href="../openapi_first/errors/#openapi_first.errors.MissingOperationHandler">MissingOperationHandler</a></code>
|
||||
<code><a class="autorefs autorefs-internal" title="openapi_first.errors.MissingOperationHandler" href="../errors/#openapi_first.errors.MissingOperationHandler">MissingOperationHandler</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>If an operationId is missing from the spec or if no corresponding handler function exists in the routes module.</p>
|
||||
<p>If an <code>operationId</code> is missing from the spec or if no corresponding
|
||||
handler function exists in the routes module.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -886,11 +895,17 @@ between OpenAPI operations and Python handler functions using operationId.</p>
|
||||
<summary>Notes</summary>
|
||||
<p><strong>Responsibilities:</strong></p>
|
||||
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
|
||||
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><code>- Iterates through the OpenAPI specification paths and methods
|
||||
- Resolves each operationId to a handler function, and registers a corresponding APIRoute on the FastAPI application
|
||||
<span class="normal">2</span>
|
||||
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><code>- Iterates through the OpenAPI specification paths and methods.
|
||||
- Resolves each `operationId` to a handler function, and registers
|
||||
a corresponding `APIRoute` on the FastAPI application.
|
||||
</code></pre></div></td></tr></table></div>
|
||||
<p><strong>Guarantees:</strong></p>
|
||||
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><code>- Route registration is deterministic and spec-driven. No route decorators are required or supported. Handler resolution errors surface at application startup.
|
||||
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
|
||||
<span class="normal">2</span>
|
||||
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><code>- Route registration is deterministic and spec-driven. No route
|
||||
decorators are required or supported. Handler resolution errors
|
||||
surface at application startup.
|
||||
</code></pre></div></td></tr></table></div>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user