Skip to content

Commit

Permalink
Update openapi page.
Browse files Browse the repository at this point in the history
  • Loading branch information
mareuter committed Mar 11, 2024
1 parent b25c99f commit f332639
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/lct_web/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@

from __future__ import annotations

from typing import Any

from fastapi import FastAPI
from fastapi.openapi.utils import get_openapi

from . import __version__
from .models.index_response import IndexResponse
from .routers import lunar_club, lunar_two, moon_info

Expand All @@ -26,6 +30,29 @@
app.include_router(lunar_two.router)


def set_schema() -> dict[str, Any]:
if app.openapi_schema:
return app.openapi_schema

openapi_schema = get_openapi(
title="Lunar Club Tools Web Service API",
version=__version__,
description=" ".join(
[
"This API provides information related to the Lunar Club and Lunar II ",
"observing clubs from the Astronomical League. It also provides ephemeris",
"information.",
]
),
routes=app.routes,
)
app.openapi_schema = openapi_schema
return app.openapi_schema


app.openapi = set_schema # type: ignore


@app.get("/")
async def root() -> IndexResponse:
return IndexResponse(msg="This is a web service, nothing to see here.")

0 comments on commit f332639

Please sign in to comment.