Skip to content
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

Fix validation messages #969

Merged
merged 9 commits into from
Feb 15, 2024
Merged

Fix validation messages #969

merged 9 commits into from
Feb 15, 2024

Conversation

justin-tay
Copy link
Contributor

This makes the following changes

  • Makes the english messages more consistent. Some of the messages use different phrasing for the same meaning.
  • The messages for unevaluatedProperties and unevaluatedItems when using a schema that is not false now just let those messages be returned instead of modifying the message. This is consistent with the other validators handling of this eg. additionalProperties.
  • The oneOf now returns the matching indexes. Note that in a typical short circuit case this will only return 2 instead of potentially more.

An attempt was made to fix the translations of jsv-messages.properties. Most of them are all corrupt and have ? or characters. Others are encoded in UTF-8 which is not supported in Java 8. UTF-8 in resource bundles are only supported from Java 9. In Java 8 they must be encoded in ISO-8859-1 with unsupported characters escaped. A LocaleTest was added to ensure that the translated messages are working as expected. A native speaker would be required for a proper fix.

@codecov-commenter
Copy link

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (7cda40e) 78.65% compared to head (8699200) 78.59%.

Files Patch % Lines
...n/java/com/networknt/schema/MaxItemsValidator.java 50.00% 1 Missing ⚠️
...om/networknt/schema/UnevaluatedItemsValidator.java 83.33% 0 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #969      +/-   ##
============================================
- Coverage     78.65%   78.59%   -0.06%     
  Complexity     1810     1810              
============================================
  Files           161      161              
  Lines          5893     5887       -6     
  Branches       1116     1119       +3     
============================================
- Hits           4635     4627       -8     
  Misses          833      833              
- Partials        425      427       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stevehu stevehu merged commit 2879ca3 into networknt:master Feb 15, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants