Skip to content

Commit

Permalink
Improve API specs and fix openapi.json link in doc (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoshiyosan authored Dec 20, 2022
1 parent 22fc003 commit 440f888
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/components/api/reference.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# ShopEat API reference

<swagger-ui src="/specs/shopeat-api.json"/>
<swagger-ui src="../../specs/shopeat-api.json"/>
15 changes: 13 additions & 2 deletions shopeat/api/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,21 @@
import shopeat.api.accounts.api
import shopeat.api.groups.api
import shopeat.api.publish.api
from shopeat.api.metadata import OPENAPI_TAGS
from shopeat.api.metadata import (
OPENAPI_DESCRIPTION,
OPENAPI_TAGS,
OPENAPI_TITLE,
OPENAPI_VERSION,
)
from shopeat.core.database import DATABASE

app = FastAPI(docs_url="/", openapi_tags=OPENAPI_TAGS)
app = FastAPI(
title=OPENAPI_TITLE,
description=OPENAPI_DESCRIPTION,
version=OPENAPI_VERSION,
docs_url="/",
openapi_tags=OPENAPI_TAGS,
)

app.include_router(shopeat.api.accounts.api.router)
app.include_router(shopeat.api.groups.api.router)
Expand Down
11 changes: 11 additions & 0 deletions shopeat/api/metadata.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
OPENAPI_TITLE = "ShopEat API"
OPENAPI_DESCRIPTION = """
Shopeat is an application that helps you plan the recipes you want to cook,
create shopping lists, and do online shopping with your friends or family.
It allows you to easily plan your meals and save time and money by organizing your shopping in an efficient way.
You can use the app to choose recipes based on your preferences and dietary needs, and then generate a shopping list
based on the required ingredients. You can also invite your friends or family to join and contribute to the shopping list,
which can be convenient when organizing shared meals or when you want to share the shopping tasks.
""".strip()
OPENAPI_VERSION = "v1"
OPENAPI_TAGS = [
{
"name": "Accounts",
Expand Down

0 comments on commit 440f888

Please sign in to comment.