Skip to content
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

Add support for generate-swagger to generate in YAML format #661

Closed
2 tasks done
segevfiner opened this issue Sep 10, 2023 · 3 comments · Fixed by #662
Closed
2 tasks done

Add support for generate-swagger to generate in YAML format #661

segevfiner opened this issue Sep 10, 2023 · 3 comments · Fixed by #662
Labels
feature request New feature to be added good first issue Good for newcomers

Comments

@segevfiner
Copy link
Contributor

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

The fastify.swagger() API also supports a { yaml: true } argument to get a YAML string. It would be nice to expose this from generate-swagger.

I would have implemented this myself, maybe even with an -o file.txt output file support. But I'm not sure how to add custom arguments for just this command with the way parseArgs works.

Motivation

OpenAPI schemas are often represented in YAML for readability, and its already supported by fastify.swagger() just need to expose this in the CLI.

Example

fastify generate-swagger --yaml -o openapi.yaml dist/app.js
@mcollina
Copy link
Member

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@mcollina mcollina added feature request New feature to be added good first issue Good for newcomers labels Sep 11, 2023
@segevfiner
Copy link
Contributor Author

Yeah. Just what should I use to parse the arguments?

@mcollina
Copy link
Member

yargs-parser

segevfiner added a commit to segevfiner/fastify-cli that referenced this issue Sep 11, 2023
mcollina pushed a commit that referenced this issue Sep 14, 2023
* Add an option to generate YAML to generate-swagger

Fixes #661

* Fix lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature to be added good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants