alexschimpf / fastapi-versionizer

FastAPI Versionizer
MIT License
79 stars 13 forks source link

how can I add another mounted sub-application? #14

Closed sevenjay closed 1 year ago

sevenjay commented 1 year ago

how can I add another mounted sub-application?

app = FastAPI(
    title='My Versioned API',
    description='Look, I can version my APIs!'
)

subapi = FastAPI()

...

versions = versionize(
    app=app,
    prefix_format='/v{major}',
    docs_url='/docs',
    redoc_url='/redoc'
)

app.mount("/subapi", subapi)

I would like to achieve the following endpoints:

    - /openapi.json
    - /versions
    - /subapi

    - /v1/docs
    - /v1/redoc
    - /v1/do_something
    - /v1/do_something_else

    - /v2/docs
    - /v2/redoc

but app.mount("/subapi", subapi) not work

sevenjay commented 1 year ago

The mounting functionality is working. However, it seems that the "/subapi/docs" endpoint is not being generated. Nonetheless, I appreciate your efforts in creating this excellent library. Thank you!