Skip to content
Snippets Groups Projects
Commit f7143983 authored by Erik Reid's avatar Erik Reid
Browse files

utility for dumping openapi spec

parent ae001c94
No related branches found
No related tags found
No related merge requests found
import json
import os
import sys
from fastapi.testclient import TestClient
import resource_management
config_filename = os.path.join(
os.path.dirname(__file__),
'..', 'config-example.json')
os.environ['SETTINGS_FILENAME'] = config_filename
app = resource_management.create_app()
client = TestClient(app)
rsp = client.get('/openapi.json')
openapi_doc = json.dumps(rsp.json(), indent=2)
if len(sys.argv) > 1 and sys.argv[1]:
with open(sys.argv[1], 'w') as output:
output.write(openapi_doc)
else:
print(openapi_doc)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment