mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-04-19 08:55:15 +00:00
26 lines
596 B
Python
26 lines
596 B
Python
|
import json
|
||
|
from pathlib import Path
|
||
|
|
||
|
from fastapi.openapi.utils import get_openapi
|
||
|
|
||
|
from akkudoktoreos.server.fastapi_server import app
|
||
|
|
||
|
|
||
|
def generate_openapi(filename: str | Path = "openapi.json"):
|
||
|
with open(filename, "w") as f:
|
||
|
json.dump(
|
||
|
get_openapi(
|
||
|
title=app.title,
|
||
|
version=app.version,
|
||
|
openapi_version=app.openapi_version,
|
||
|
description=app.description,
|
||
|
routes=app.routes,
|
||
|
),
|
||
|
f,
|
||
|
indent=2,
|
||
|
)
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
generate_openapi()
|