Skip to content

Commit

Permalink
feat(runner): add 'servers' to OpenAPI spec (#64)
Browse files Browse the repository at this point in the history
This commit adds the servers field to the OpenAPI spec and makes the
resulting JSON file human readable.
  • Loading branch information
rickstaa committed Apr 20, 2024
1 parent 7e85929 commit 217c1a5
Show file tree
Hide file tree
Showing 2 changed files with 500 additions and 486 deletions.
8 changes: 8 additions & 0 deletions runner/gen_openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import yaml
import argparse

# Specify Endpoints for OpenAPI schema generation.
SERVERS = [
{"url": "http://gateway-endpoint.ai/", "description": "Example Gateway"},
]


def write_openapi(fname):
"""Write OpenAPI schema to file.
Expand All @@ -31,6 +36,7 @@ def write_openapi(fname):
openapi_version=app.openapi_version,
description="An application to run AI pipelines",
routes=app.routes,
servers=SERVERS,
),
f,
sort_keys=False,
Expand All @@ -43,8 +49,10 @@ def write_openapi(fname):
openapi_version=app.openapi_version,
description="An application to run AI pipelines",
routes=app.routes,
servers=SERVERS,
),
f,
indent=4, # Make human readable.
)
print("OpenAPI schema generated and saved.")

Expand Down

0 comments on commit 217c1a5

Please sign in to comment.