mirror of
https://github.com/hay-kot/mealie.git
synced 2025-07-07 05:22:18 -07:00
dev: Improve Docs Generation (#4402)
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
parent
674ad237f1
commit
a7c8b33cca
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue