fastify-cli icon indicating copy to clipboard operation
fastify-cli copied to clipboard

support --options flag in generate-swagger

Open gi-jacob opened this issue 8 months ago • 2 comments

Checklist

gi-jacob avatar Apr 18 '25 17:04 gi-jacob

Oh gosh, please write a comprehensive PR description next time

This fix relates to #687 and it propagates the same fix to the generate swagger command because if you write generate-swagger --options it is ignored.

It is not clear to me why this option is needed: this command spins up a fastify (without listening) and it generates the swagger. Whatever hooks and additional configurations should not matter.

Could you help me with an example? In case, could you add a test in the test/generate-swagger.test.js file?

Sure, I have custom keywords defined for the ajv schemas I use. In order for the generate-swagger command to work I need to pass ajv options to fastify. Without this the schemas fail validation and the swagger output fails to generate.

gi-jacob avatar Nov 07 '25 17:11 gi-jacob

Ok, thanks for helping me

Would you mind to add a test? Without it we can't garantee to remove this feature accidentally in future

Eomm avatar Nov 08 '25 10:11 Eomm