PrefectHQ / prefect

Prefect is a workflow orchestration framework for building resilient data pipelines in Python.
https://prefect.io
Apache License 2.0
16.87k stars 1.61k forks source link

Publish OpenAPI YAML spec in CI/CD #14970

Open aaazzam opened 2 months ago

aaazzam commented 2 months ago

Describe the current behavior

The OpenAPI YAML specification is not currently published, but can be inspected at runtime.

Describe the proposed behavior

It would be beneficial to automatically generate and publish our FastAPI OpenAPI specification in YAML format. This could be done on each successful merge to the main branch.

Potential steps:

Benefits:

FastAPI already generates the OpenAPI spec. The main task would be exporting and publishing it in YAML format. This enhancement could improve the API's accessibility and ease of integration. Thoughts, suggestions, or volunteers to implement this are welcome!

Example Use

No response

Additional context

No response

aaazzam commented 2 months ago

I think it's literally this in CI/CD:

from prefect.server.api.server import create_app
import yaml

with open('openapi.yaml', 'w') as file:
    yaml.dump(create_app().openapi(), file)