Repository navigation
Test that a required array with validated inline items rejects value - #174
Merged
Merged
Conversation
…ing or null value
This file contains hidden or 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
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.
A required array with inline items that carry a constraint, such as a pattern, accepted {} and
{"inline":null}, while the same array with $ref items was rejected.A struct's Validate() skipped the array's own required tag whenever it checked the items, and minItems skips nil, so nothing caught an absent array.
The required check is emitted again since #172, which checks the array's own tags before its items. This PR adds the end-to-end regression test for the report, so it doesn't come back.
What changes
examples/requests/array-item-countsgets a required codes body property with minItems: 1 and items bound by a pattern, the shape from the issue.gen_test.gosends the body with codes missing, null, [] and a non-matching item, and expects a 400 without the service being called. A valid body still passes.No generator change.
Fixes #171