diff --git a/Taskfile.yml b/Taskfile.yml index f595828da..716e3e7b3 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -25,16 +25,9 @@ dotenv: - .env - .dev.env tasks: - docs:gen: - desc: runs the API documentation generator - cmds: - - uv run python dev/code-generation/gen_docs_api.py - docs: desc: runs the documentation server dir: docs - deps: - - docs:gen cmds: - uv run python -m mkdocs serve @@ -81,7 +74,6 @@ tasks: desc: run code generators cmds: - uv run python dev/code-generation/main.py {{ .CLI_ARGS }} - - task: docs:gen - task: py:format dev:services: @@ -350,4 +342,4 @@ tasks: vars: { WAIT_UNTIL_HEALTHY: true } - defer: { task: e2e:stop-server } - task: e2e:test - vars: { PREVENT_REPORT_OPEN: true } \ No newline at end of file + vars: { PREVENT_REPORT_OPEN: true } diff --git a/dev/code-generation/gen_docs_api.py b/dev/code-generation/gen_docs_api.py deleted file mode 100644 index 4a300fecb..000000000 --- a/dev/code-generation/gen_docs_api.py +++ /dev/null @@ -1,80 +0,0 @@ -import json -from datetime import UTC, datetime -from typing import Any - -from fastapi import FastAPI - -from mealie.app import app -from mealie.core.config import determine_data_dir - -DATA_DIR = determine_data_dir() - -"""Script to export the ReDoc documentation page into a standalone HTML file.""" - -HTML_TEMPLATE = """ -{% extends "main.html" %} -{% block tabs %} -{{ super() }} - - - - -
- - - - -{% endblock %} -{% block content %}{% endblock %} -{% block footer %}{% endblock %} -""" - -HTML_PATH = DATA_DIR.parent.parent.joinpath("docs/docs/overrides/api.html") -CONSTANT_DT = datetime(2025, 10, 24, 15, 53, 0, 0, tzinfo=UTC) - - -def normalize_timestamps(s: dict[str, Any]) -> dict[str, Any]: - field_format = s.get("format") - is_timestamp = field_format in ["date-time", "date", "time"] - has_default = s.get("default") - - if not is_timestamp: - for k, v in s.items(): - if isinstance(v, dict): - s[k] = normalize_timestamps(v) - elif isinstance(v, list): - s[k] = [normalize_timestamps(i) if isinstance(i, dict) else i for i in v] - - return s - elif not has_default: - return s - - if field_format == "date-time": - s["default"] = CONSTANT_DT.isoformat() - elif field_format == "date": - s["default"] = CONSTANT_DT.date().isoformat() - elif field_format == "time": - s["default"] = CONSTANT_DT.time().isoformat() - - return s - - -def generate_api_docs(my_app: FastAPI): - openapi_schema = my_app.openapi() - openapi_schema = normalize_timestamps(openapi_schema) - - with open(HTML_PATH, "w") as fd: - text = HTML_TEMPLATE.replace("MY_SPECIFIC_TEXT", json.dumps(openapi_schema)) - fd.write(text) - - -if __name__ == "__main__": - generate_api_docs(app) diff --git a/docs/docs/api/redoc.md b/docs/docs/api/redoc.md deleted file mode 100644 index b50c745c1..000000000 --- a/docs/docs/api/redoc.md +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: API -template: api.html ---- diff --git a/docs/docs/overrides/api.html b/docs/docs/overrides/api.html deleted file mode 100644 index 14f1fa43a..000000000 --- a/docs/docs/overrides/api.html +++ /dev/null @@ -1,24 +0,0 @@ - -{% extends "main.html" %} -{% block tabs %} -{{ super() }} - - - - - - - - - -{% endblock %} -{% block content %}{% endblock %} -{% block footer %}{% endblock %} diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 7bfda82c0..e79a98ba4 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -93,7 +93,7 @@ nav: - iOS Shortcut: "documentation/community-guide/ios-shortcut.md" - Reverse Proxy (SWAG): "documentation/community-guide/swag.md" - - API Reference: "api/redoc.md" + - API Reference: "https://demo.mealie.io/docs" - Contributors Guide: - Non-Code: "contributors/non-coders.md" diff --git a/frontend/nuxt.config.ts b/frontend/nuxt.config.ts index 47512783e..8abd53a6f 100644 --- a/frontend/nuxt.config.ts +++ b/frontend/nuxt.config.ts @@ -219,7 +219,7 @@ export default defineNuxtConfig({ }, workbox: { navigateFallback: "/", - navigateFallbackAllowlist: [/^(?!\/api|\/docs|\/redoc)/], + navigateFallbackAllowlist: [/^(?!\/api|\/docs)/], globPatterns: ["**/*.{js,css,html,png,svg,ico}"], globIgnores: ["404.html", "200.html"], cleanupOutdatedCaches: true, diff --git a/mealie/app.py b/mealie/app.py index 4309050a6..26fad8293 100644 --- a/mealie/app.py +++ b/mealie/app.py @@ -102,7 +102,6 @@ app = FastAPI( description=description, version=APP_VERSION, docs_url=settings.DOCS_URL, - redoc_url=settings.REDOC_URL, lifespan=lifespan_fn, ) diff --git a/mealie/core/settings/settings.py b/mealie/core/settings/settings.py index e2bcfa6f9..ee08d95cc 100644 --- a/mealie/core/settings/settings.py +++ b/mealie/core/settings/settings.py @@ -199,10 +199,6 @@ class AppSettings(AppLoggingSettings): def DOCS_URL(self) -> str | None: return "/docs" if self.API_DOCS else None - @property - def REDOC_URL(self) -> str | None: - return "/redoc" if self.API_DOCS else None - # =============================================== # Database Configuration diff --git a/tests/unit_tests/test_config.py b/tests/unit_tests/test_config.py index 15014542a..7920fa906 100644 --- a/tests/unit_tests/test_config.py +++ b/tests/unit_tests/test_config.py @@ -23,7 +23,6 @@ def test_non_default_settings(monkeypatch): assert app_settings.API_PORT == 8000 assert app_settings.API_DOCS is False - assert app_settings.REDOC_URL is None assert app_settings.DOCS_URL is None