dev: Improve Docs Generation ()

Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
Michael Genson 2024-10-21 10:01:40 -05:00 committed by GitHub
parent 674ad237f1
commit a7c8b33cca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 30 additions and 11 deletions

@ -1,5 +1,8 @@
import json
from fastapi import FastAPI
from freezegun import freeze_time
from mealie.app import app
from mealie.core.config import determine_data_dir
@ -36,11 +39,12 @@ HTML_TEMPLATE = """<!-- Custom HTML site displayed as the Home chapter -->
HTML_PATH = DATA_DIR.parent.parent.joinpath("docs/docs/overrides/api.html")
def generate_api_docs(my_app):
def generate_api_docs(my_app: FastAPI):
with open(HTML_PATH, "w") as fd:
text = HTML_TEMPLATE.replace("MY_SPECIFIC_TEXT", json.dumps(my_app.openapi()))
fd.write(text)
if __name__ == "__main__":
generate_api_docs(app)
with freeze_time("2024-01-20T17:00:55Z"):
generate_api_docs(app)

File diff suppressed because one or more lines are too long

@ -6,9 +6,9 @@ prefix = "/recipes"
router = APIRouter()
router.include_router(recipe_crud_routes.router_exports)
router.include_router(recipe_crud_routes.router)
router.include_router(recipe_crud_routes.router_exports, tags=["Recipe: Exports"])
router.include_router(recipe_crud_routes.router, tags=["Recipe: CRUD"])
router.include_router(comments.router, prefix=prefix, tags=["Recipe: Comments"])
router.include_router(bulk_actions.router, prefix=prefix, tags=["Recipe: Bulk Exports"])
router.include_router(bulk_actions.router, prefix=prefix, tags=["Recipe: Bulk Actions"])
router.include_router(shared_routes.router, prefix=prefix, tags=["Recipe: Shared"])
router.include_router(timeline_events.events_router, prefix=prefix, tags=["Recipe: Timeline"])

@ -17,7 +17,7 @@ from mealie.schema.recipe.recipe_bulk_actions import (
from mealie.schema.response.responses import SuccessResponse
from mealie.services.recipe.recipe_bulk_service import RecipeBulkActionsService
router = APIRouter(prefix="/bulk-actions", tags=["Recipe: Bulk Actions"])
router = APIRouter(prefix="/bulk-actions")
@controller(router)

@ -123,7 +123,7 @@ class FormatResponse(BaseModel):
jinja2: list[str]
router_exports = UserAPIRouter(prefix="/recipes", tags=["Recipe: Exports"])
router_exports = UserAPIRouter(prefix="/recipes")
@controller(router_exports)
@ -176,7 +176,7 @@ class RecipeExportController(BaseRecipeController):
)
router = UserAPIRouter(prefix="/recipes", tags=["Recipe: CRUD"], route_class=MealieCrudRoute)
router = UserAPIRouter(prefix="/recipes", route_class=MealieCrudRoute)
@controller(router)

18
poetry.lock generated

@ -1,4 +1,4 @@
# This file is automatically @generated by Poetry 1.8.1 and should not be changed by hand.
# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
[[package]]
name = "aiofiles"
@ -660,6 +660,20 @@ files = [
docs = ["furo (>=2022.12.7)", "sphinx (>=5.3)", "sphinx-autodoc-typehints (>=1.19.5)"]
testing = ["covdefaults (>=2.2.2)", "coverage (>=7.0.1)", "pytest (>=7.2)", "pytest-cov (>=4)", "pytest-timeout (>=2.1)"]
[[package]]
name = "freezegun"
version = "1.5.1"
description = "Let your Python tests travel through time"
optional = false
python-versions = ">=3.7"
files = [
{file = "freezegun-1.5.1-py3-none-any.whl", hash = "sha256:bf111d7138a8abe55ab48a71755673dbaa4ab87f4cff5634a4442dfec34c15f1"},
{file = "freezegun-1.5.1.tar.gz", hash = "sha256:b29dedfcda6d5e8e083ce71b2b542753ad48cfec44037b3fc79702e2980a89e9"},
]
[package.dependencies]
python-dateutil = ">=2.7"
[[package]]
name = "ghp-import"
version = "2.1.0"
@ -3400,4 +3414,4 @@ pgsql = ["psycopg2-binary"]
[metadata]
lock-version = "2.0"
python-versions = "^3.10"
content-hash = "34cb3db74c1e5f37480fbc20b25f09fa577272d1eb8602bad0ce064ee20f1e02"
content-hash = "455f4f29104e6614f7ff7e899cf2d63302cd84dd693b59ee17d48ca05fd39543"

@ -71,6 +71,7 @@ types-python-slugify = "^6.0.0"
types-requests = "^2.27.12"
types-urllib3 = "^1.26.11"
pydantic-to-typescript2 = "^1.0.4"
freezegun = "^1.5.1"
[build-system]