Skip to content

Nesting FastAPI instances doesn't work very well #8

@kkinder

Description

@kkinder

Do this:

main_app = FastAPI()
sub_api = FastAPI()

...
main_app.router.routes.append(Mount('/subapi', app=sub_api))

sub_api will correctly serve ever /subapi -- docs, methods, all that. However, the docs will still look for /openapi.json (absolute link) when trying to load the openapi spec. Additionally, the spec will not be adjusted to have the correct links, relative to where the module is mounted.

Perhaps this is a corner use case, but a lot of apps might have different collections of routes mounted in different subpaths.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions