Ensure parser uses errorMessage for minContains/maxContains #229
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.
Prior to this change, the language server ignored any defined
errorMessagewhen a subschema fails validation for acontainskeyword andminContainsis defined. TheerrorMessagewas only used whenminContainswas not defined and no item in the array matched the subschema. Even ifminContainsisn't defined, the parser ignoreserrorMessagewhen the array contains more matching items thanmaxContainsallows.This change updates the parser to use the
errorMessage, if defined, for any failure of thecontainskeyword, regardless of the values ofminContainsandmaxContains.This is useful for cases where a developer wants to define an error message indicating both what the schema expects to contain and how many times. The default error message is not very helpful in these cases, because most users won't know how to look up "the contains contraint" for whatever file they're working with.