OpenAPI
rn_forge.fastapi.openapi
Repair FastAPI OpenAPI documents to match the shared wire contract.
Accuracy only: the repair adds the ProblemDetail component and declares
the problem+json responses the app can actually produce, and removes
FastAPI's replaced validation schema. It does not rename components or pin an
OpenAPI version.
operation_id(route)
Return the operationId for route, per :func:rn_forge.web.operation_id.
Pass it as FastAPI(generate_unique_id_function=operation_id). Use an
explicit operation_id= for routes that cannot follow the shared rule.
repair_problem_schema(schema, *, registry=None)
Repair schema in place: declare the problem responses, and nothing else.
Called once by :meth:rn_forge.fastapi.app.FastApiApp.openapi against the
document it caches, so the repair never re-runs. It keeps the
ProblemDetail component, adds an application/problem+json response
for each of registry's statuses (plus 500) to every operation that does
not already declare one, and replaces FastAPI's own 422 — the validation
handlers have replaced the body it describes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema
|
dict[str, Any]
|
The document FastAPI built, as returned by its own
|
required |
registry
|
ProblemRegistry | None
|
The rows the app's problem handlers render with. Defaults to
:func: |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
schema, for chaining. |