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 enum validator messages for object, array and text nodes #1095

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

justin-tay
Copy link
Contributor

Closes #1094

This fixes the enum validator messages as previously object and array nodes were empty strings and the text nodes outputted text without the quotes.

For example given the schema

{
  "enum": [6, "foo", [], true, {"foo": 12}]
}

The message is now

: does not have a value in the enumeration [6, "foo", [], true, {"foo":12}]

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.09%. Comparing base (48ca3c2) to head (f09cf1d).
Report is 52 commits behind head on master.

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

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1095      +/-   ##
============================================
- Coverage     78.90%   78.09%   -0.81%     
- Complexity     1965     2074     +109     
============================================
  Files           172      201      +29     
  Lines          6352     6889     +537     
  Branches       1255     1265      +10     
============================================
+ Hits           5012     5380     +368     
- Misses          867     1036     +169     
  Partials        473      473              

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

@stevehu stevehu merged commit b160c11 into networknt:master Jul 25, 2024
4 checks passed
@jochenberger
Copy link

IMHO, this kind of change should not have been made in a patch-level release.

@stevehu
Copy link
Contributor

stevehu commented Jul 26, 2024

@jochenberger The change is a bug fix and does not break any API. That is why it is a patch release. We can bump up the minor version if there is a reason. Thanks.

@stevehu
Copy link
Contributor

stevehu commented Jul 26, 2024

As we have added double quotes into the error message, it might break some applications that use the validation message as part of the JSON object. Some escapes are necessary to handle the double quote or back-slash in the validation message.

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.

Missing error text details for values of enumeration when enum type is JSON object
4 participants