Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version to openapi.json path #182

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions api/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from api.models.repository import repository_create, Repository

from fastapi import FastAPI
from fastapi.openapi.docs import get_redoc_html

from typing import AsyncGenerator

from api.api_logging import log_info
Expand All @@ -31,6 +33,16 @@ async def repository_dependency() -> AsyncGenerator[Repository, None]:
app.include_router(auth.router, prefix="/v2")


@app.get("/v2/openapi.json", include_in_schema=False)
async def get_custom_openapi():
return app.openapi()


@app.get("/v2/redoc", include_in_schema=False)
async def custom_redoc():
return get_redoc_html(openapi_url="/v2/openapi.json", title="BioImage Archive API")


@app.on_event("startup")
def on_start():
log_info("App started")
Expand Down
Loading