-
Notifications
You must be signed in to change notification settings - Fork 86
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 optional reporting of failing validation #44
Comments
I like this idea. I only added the As for the One thing to note is, not all validations have a "name" that maps back into a configuration rule. There are some rules that are so basic and fundamental to the OpenAPI spec that we don't bother documenting them or making them configurable (example). This isn't a deal-breaker of course but we would want to think about what to print for the output for these cases. As always, you are more than welcome to write a PR for this! If you are unable, I can try to look at it in the coming weeks. Thanks for the issue |
--print_rule_name ? No opinion here, whatever you think is intuitive. Perhaps for those validations you mention above we can make up a name for them that follows a pattern, e.g. "builtin_xxxxx" where and then simply document that it is not possible to turn builtin_* rules off or something like that. I am guessing that implementing this will require adding an additional field to the JSON result object in each individual test? I suppose it will be easy enough since in the place where the test is run you are checking for the config enabling the test anyway so the string is right there. As an FYI, I am currently writing an API validation SaaS offering and associated command line tools that will be used internally inside of VMware for API specifications across the company. We have many different APIs and lots of different legacy APIs that have their own way of doing things, so flexibility is key. Right now I am planning on spawning/calling lint-openapi from this service as a major part of the API validation. This is driving my desire for the --json option as well as the --print_rule_names and such. This service itself may end up being open source (I am pushing for this) |
We should evaluate the open pr that Barrett openend. |
Fixed in #44. |
lint-openapi has a "--print_validator_modules" which prints the name of the module that contains the failing validation, but this information is of limited value because the information is an implementation detail that is invisible to a user of the tool from the command line. It would be nice to have another option that resulted in printing the actual name of the config option that resulted in the validation failure so that users can understand what config option controls that result.
Today I see this for example:
It would be ideal to have something like this:
(sorry about the alignment above, dang markdown and non-fixed-width font)
It is true that the messages are directly correlated to the message, but the only way to do this now that I see is building a map of messages to the validator config names, which seems like a fragile and non scalable way to do it.
I am happy to help with implementation by submitting a PR.
The text was updated successfully, but these errors were encountered: