readmeio / rdme

ReadMe's official command-line interface (CLI) and GitHub Action 🌊
https://docs.readme.com/main/docs/rdme
MIT License
108 stars 43 forks source link

No `--raw` flag recognized for `openapi:validate` command #1033

Open Try431 opened 2 months ago

Try431 commented 2 months ago

The docs specify that passing in a --raw flag to any of the openapi commands should yield the result in a JSON object, so that the commands can be used in a script. However, at least as of v8.6.6 (which is what I'm on), I only get an error:

$ npx rdme@v8 openapi:validate swagger.yaml --raw

Unknown option: --raw

Is this a bug, or should the documentation be updated to clarify that openapi:validate can't be used programmatically? It'd be really helpful to be able to check the output before syncing a newly-generated swagger doc in our CI.

Thanks!

kanadgupta commented 2 months ago

Hi @Try431! The --raw flag is only available on openapi, not on openapi:validate. Apologies for the confusion there.

Our validation errors may change without warning so we don't recommend relying on the validation output itself, which is why I'm a little hesitant to ship a --raw flag for openapi:validate.

As a safer alternative, I'd recommend using the exit code instead. For all rdme commands, a zero exit code indicates a successful state and a non-zero exit code indicates an error. Would that work for your use case?