Bootstrap Python rewrite skeleton
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
from app.main import create_app
|
||||
|
||||
|
||||
def main() -> None:
|
||||
app = create_app()
|
||||
output_dir = Path("openapi")
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
schema = app.openapi()
|
||||
|
||||
json_path = output_dir / "openapi.json"
|
||||
yaml_path = output_dir / "openapi.yaml"
|
||||
|
||||
json_path.write_text(__import__("json").dumps(schema, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
yaml_path.write_text(yaml.safe_dump(schema, allow_unicode=True, sort_keys=False), encoding="utf-8")
|
||||
|
||||
print(f"Wrote {json_path}")
|
||||
print(f"Wrote {yaml_path}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user