ash_json_api
ash_json_api copied to clipboard
Add support for outputting OpenAPI spec in YAML format
Add an option to specify the format for the open api spec.
Usage:
use AshJsonApi.Router,
domains: [Module.concat(["Helpdesk.Support"])],
json_schema: "/json_schema",
open_api: "/open_api",
open_api_format: :yaml
Would require an additional dependency {:ymlr, "~> 2.0"}
Contributor checklist
- [ ] Bug fixes include regression tests
- [ ] Features include unit/acceptance tests
This is a great idea!
I think what we could do perhaps for the configuration is instead is something like
formats: [
json: "/json",
yaml: "/yaml"
]
Then, for each format, we serve the schema at that format at that route. The default would be
[json: "/"]
This avoids having to choose between one or the other.
Then, we'll make the yaml one error if Ymlr is not defined (if Code.ensure_loaded?(Ymlr), and explain in the docs that you need to add that dependency for it to work.
Happy to update the PR. Will find some time within the next week.