Surnet / swagger-jsdoc

Generates swagger/openapi specification based on jsDoc comments and YAML files.
MIT License
1.66k stars 224 forks source link

Add --bail cli flag, exit with non-zero status if scanning results in error, fixes: #370 #371

Open vidhill opened 11 months ago

vidhill commented 11 months ago

Feature request #370

When using the swagger-jsdoc cli in an npm script

If the scan fails the process currently exits with an exit code 0 which indicates success

When running on CICD for example,
I would like the job to fail so the process would need to exit with non-zero code

This PR adds a cli flag (--bail), when the flag is set exit with non-zero code if scanning fails

e.g.

npx swagger-jsdoc -d definition.js -o api-docs.json index.js --bail

If the scan fails, the script exits with code 1 otherwise it exits with 0 as normal

stale[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.