Skip to content

OpenAPI plumbing: unreachable openapi_schema() call, duplicate handler names, and a 3.0.2/3.1.0 version mismatch #402

Description

@gaurav

Three small things found while moving the endpoint documentation out of resources/openapi.yml and into the route decorators. None is urgent; grouping them rather than filing three issues.

1. apidocs.py:41 calls a dict. construct_open_api_schema() starts with:

if app.openapi_schema:
    return app.openapi_schema()

app.openapi_schema is a dict, so this would raise TypeError: 'dict' object is not callable. It is unreachable today only because server.py assigns app.openapi_schema = construct_open_api_schema(app) directly rather than going through app.openapi(). Should be return app.openapi_schema.

2. Duplicate function names. get_setid is defined twice (server.py:327 and :348) and get_curie_prefixes_handler is defined twice (:394 and :407). The routes register correctly because FastAPI keys off the decorator, but the module-level name only binds to the second definition, and FastAPI derives operationId from the function name — so the generated operation IDs collide, which some client generators reject.

3. Declared OpenAPI version is ignored. resources/openapi.yml starts with openapi: 3.0.2, but that key is never copied into the served schema, and FastAPI 0.108 emits 3.1.0. If SmartAPI or Translator registration expects 3.0.x, this is the reason. Worth either deleting the misleading key or actually pinning the emitted version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions