M15: synchronize contracts and acceptance
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"""Generate the checked-in API contract from the FastAPI application."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(ROOT / "backend"))
|
||||
|
||||
from app.main import app # noqa: E402
|
||||
|
||||
|
||||
def main() -> None:
|
||||
schema = app.openapi()
|
||||
schema["info"]["description"] = (
|
||||
"Generated contract for Fleet Ops. The visible product name is Fleet Ops; "
|
||||
"MobilityOps remains the technical repository and service identifier."
|
||||
)
|
||||
schema["servers"] = [{"url": "http://localhost:8128"}]
|
||||
output = ROOT / "contracts" / "openapi.yaml"
|
||||
output.write_text(
|
||||
yaml.safe_dump(schema, sort_keys=False, allow_unicode=True, width=100),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user