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
document and test that errors are spat out in a defined order #223
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The code change in lib/JSON/Validator.pm appears to be redundant at the moment, as the tests passed without it, but I'm putting it there anyway so that any future internals changes that affect ordering don't suddenly start causing test failures.
jhthorsen
requested changes
Oct 3, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR 👍
In addition to the inline comments: I don’t think the code is run through perltidy. Please do so, if not.
We now rely on perl's hash order randomisation to perturb the order in which errors are generated internally before we sort them on output
jhthorsen
pushed a commit
that referenced
this pull request
Oct 5, 2020
- Errors are now reported in a predictable order #223 Contributor: David Cantrell
Thanks for the PR. This is now part of version 4.05. I did forget to squash the commits though. Please help me next time, by force pushing changes. |
Thanks |
jhthorsen
pushed a commit
that referenced
this pull request
Jan 24, 2021
- Add JSON::Validator::Schema::OpenAPIv2 * Extends JSON::Validator::Schema::Draft4 * Can validate OpenAPIv2 API specifiation * Can validate HTTP request and response * Can validate "Accept" and "Content-Type" * Can handle "discriminator" * Can handle "readOnly" parameters * Can handle collectionFormat * Can handle default values for parameters * Can convert specifiation with invalid "$ref" into a valid OpenAPIv2 specifiation * Will coerce query parameters and headers into arrays if needed - Add JSON::Validator::Schema::OpenAPIv3 * Extends JSON::Validator::Schema::Draft201909 * Can validate OpenAPIv3 API specifiation * Can validate HTTP request and response * Can validate "Accept" and "Content-Type" * Can handle "discriminator" * Can handle "nullable" parameters * Can handle "readOnly" parameters * Can handle "style" and "explode" for arrays and objects parameters * Can handle "writeOnly" parameters * Can handle default values for parameters * Will coerce query parameters and headers into arrays if needed - Add negotiate_content_type() utility function - Fix t/load-file.t on Windows #234 - Fix not checking if input schema is a file if it has a newline #223 #233 Contributor: David Cantrell - Improved error message when loading non-existing file #231
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The code change in lib/JSON/Validator.pm appears to be redundant at
the moment, as the tests passed without it, but I'm putting it there
anyway so that any future internals changes that affect ordering don't
suddenly start causing test failures.
Summary
The list of errors spat out by
...->validate()
are now guaranteed to be ina predictable order, which is documented.
Motivation
Documenting the order of errors makes it easier to write tests for error conditions.
References
#222