faster_sam.openapi module¶
- faster_sam.openapi.custom_openapi(
- app,
- openapi_schema,
Returns an OpenAPI schema generator function for FastAPI.
The generator function uses the given input schema as the base to generate a new schema combining it with the auto-generated by FastAPI.
e.g
>>> with open("swagger.json") as fp: ... schema = json.load(fp) ... >>> app = FastAPI() >>> app.openapi = custom_openapi(app, schema)
- Parameters:
app (FastAPI) – A FastAPI application instance.
openapi_schema (Dict[str, Any]) – OpenAPI schema to be merged with the new one.
- Returns:
A callable function that generates the OpenAPI schema.
- Return type:
Callable[[], Dict[str, Any]]