-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command to generate swagger/openapi schema from @fastify/swagger #563
Comments
We have some code for doing this in Platformatic: https://github.com/platformatic/platformatic/blob/main/packages/db/lib/gen-schema.mjs I don't think this should be part of fastify-cli as having an OpenAPI definition is likely too opinionated. |
As just a subcommand, or as a plugin to fastify-cli itself? Or an external command that uses some the same code that fastify-cli uses to import the app (Which might not be exported ATM)? |
The problem is that this does not bundle |
Conditionally at runtime, the user will have to install it in his app, we will only check if it exists on the app instance rather than try to use our own copy. |
I would love to see how you'd implement this. However I'm not sure this would land. |
Prerequisites
🚀 Feature Proposal
It would be cool to have a CLI command to generate the swagger/openapi schema that @fastify/swagger generates to a file.
Motivation
So that I won't have to start the server or eject and write a custom script to achieve this.
(Could make sense as a plugin for fastify-cli itself, but I don't think fastify-cli supports plugins supplying custom commands)
Example
Which will essentially call
fastify.swagger()
and print it out. Of course, output file flags, flag to generate yaml, etc. Are also welcome.The text was updated successfully, but these errors were encountered: