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

Refactor walk #986

Merged
merged 13 commits into from
Mar 12, 2024
Merged

Refactor walk #986

merged 13 commits into from
Mar 12, 2024

Conversation

justin-tay
Copy link
Contributor

Closes #441, closes #467, closes #841, closes #868, closes #882

This contains breaking changes to those using the walk functionality

When using the walker with defaults the default across a $ref are properly resolved and used.

The behavior for the property listener is now more consistent whether or not validation is enabled. Previously if validation is enabled but the property is null the property listener is not called while if validation is not enabled it will be called. Now the property listener will be called in both scenarios.

The following are the breaking changes to those using the walk functionality. Previously there wasn't a way to get the JsonSchema of the schema that was referenced by the schemaNode and it was unclear what the schemaLocation or evaluationPath was referring to.

WalkEvent

Field Change Notes
schemaLocation Removed For keywords: getValidator().getSchemaLocation(). For items and properties: getSchema().getSchemaLocation()
evaluationPath Removed For keywords: getValidator().getEvaluationPath(). For items and properties: getSchema().getEvaluationPath()
schemaNode Removed getSchema().getSchemaNode()
parentSchema Removed getSchema().getParentSchema()
schema New For keywords this is the parent schema of the validator. For items and properties this is the item or property schema being evaluated.
node Renamed instanceNode
currentJsonSchemaFactory Removed getSchema().getValidationContext().getJsonSchemaFactory()
validator New The validator indicated by the keyword.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 62.03704% with 41 lines in your changes are missing coverage. Please review.

Project coverage is 78.76%. Comparing base (95911ba) to head (65be26c).
Report is 1 commits behind head on master.

Files Patch % Lines
...ain/java/com/networknt/schema/utils/JsonNodes.java 52.17% 9 Missing and 2 partials ⚠️
...ava/com/networknt/schema/ItemsValidator202012.java 0.00% 7 Missing ⚠️
...ava/com/networknt/schema/PrefixItemsValidator.java 0.00% 7 Missing ⚠️
...ava/com/networknt/schema/utils/JsonSchemaRefs.java 50.00% 3 Missing and 2 partials ⚠️
...main/java/com/networknt/schema/ItemsValidator.java 60.00% 3 Missing and 1 partial ⚠️
...main/java/com/networknt/schema/walk/WalkEvent.java 77.77% 2 Missing ⚠️
src/main/java/com/networknt/schema/JsonSchema.java 92.30% 0 Missing and 1 partial ⚠️
...a/com/networknt/schema/MaxPropertiesValidator.java 0.00% 1 Missing ⚠️
...a/com/networknt/schema/MinPropertiesValidator.java 0.00% 1 Missing ⚠️
...java/com/networknt/schema/PropertiesValidator.java 93.75% 0 Missing and 1 partial ⚠️
... and 1 more

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

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #986      +/-   ##
============================================
+ Coverage     78.51%   78.76%   +0.24%     
- Complexity     1866     1919      +53     
============================================
  Files           169      172       +3     
  Lines          6088     6197     +109     
  Branches       1153     1199      +46     
============================================
+ Hits           4780     4881     +101     
+ Misses          871      861      -10     
- Partials        437      455      +18     

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

@stevehu stevehu merged commit 0f983b0 into networknt:master Mar 12, 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
3 participants