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

Support schema resource #922

Merged

Conversation

justin-tay
Copy link
Contributor

Closes #503, closes #526, closes #918

This adds support for using schema resources in schema bundling. These changes make all required tests in the JSON Schema Test Suite from Draft 4 to 7 pass.

This also fixes some issues with the validation context, refs and enum validator.

The following comparisons are obtained using https://github.com/creek-service/json-schema-validation-comparison

Functional Comparison

Existing

Implementations Overall DRAFT_03 DRAFT_04 DRAFT_06 DRAFT_07 DRAFT_2019_09 DRAFT_2020_12
NetworkNt pass: r:4544 (96.6%) o:2235 (94.3%)
fail: r:159 (3.4%) o:135 (5.7%)
pass: r:593 (98.8%) o:231 (92.0%)
fail: r:7 (1.2%) o:20 (8.0%)
pass: r:779 (97.9%) o:297 (93.4%)
fail: r:17 (2.1%) o:21 (6.6%)
pass: r:859 (97.6%) o:510 (94.3%)
fail: r:21 (2.4%) o:31 (5.7%)
pass: r:1166 (97.1%) o:595 (95.2%)
fail: r:35 (2.9%) o:30 (4.8%)
pass: r:1147 (93.6%) o:602 (94.8%)
fail: r:79 (6.4%) o:33 (5.2%)

With Changes

Implementations Overall DRAFT_03 DRAFT_04 DRAFT_06 DRAFT_07 DRAFT_2019_09 DRAFT_2020_12
NetworkNt pass: r:4637 (98.6%) o:2242 (94.6%)
fail: r:66 (1.4%) o:128 (5.4%)
pass: r:600 (100.0%) o:232 (92.4%)
fail: r:0 (0.0%) o:19 (7.6%)
pass: r:796 (100.0%) o:299 (94.0%)
fail: r:0 (0.0%) o:19 (6.0%)
pass: r:880 (100.0%) o:512 (94.6%)
fail: r:0 (0.0%) o:29 (5.4%)
pass: r:1192 (99.3%) o:596 (95.4%)
fail: r:9 (0.7%) o:29 (4.6%)
pass: r:1169 (95.4%) o:603 (95.0%)
fail: r:57 (4.6%) o:32 (5.0%)

Performance Comparison

Existing

Benchmark Mode Score Score Error (99.9%) Unit
measureDraft_03_SchemaFriend avgt 1.8363 ms/op
measureDraft_04_Everit avgt 1.4306 ms/op
measureDraft_04_Justify avgt 2.2475 ms/op
measureDraft_04_Medeia avgt 1.4881 ms/op
measureDraft_04_NetworkNt avgt 2.2286 ms/op
measureDraft_04_SchemaFriend avgt 2.3453 ms/op
measureDraft_04_Vertx avgt 2.8329 ms/op
measureDraft_06_Everit avgt 1.4255 ms/op
measureDraft_06_Justify avgt 2.0254 ms/op
measureDraft_06_Medeia avgt 1.0577 ms/op
measureDraft_06_NetworkNt avgt 1.9621 ms/op
measureDraft_06_SchemaFriend avgt 2.8577 ms/op
measureDraft_06_Snow avgt 10.563 ms/op
measureDraft_07_Everit avgt 1.5842 ms/op
measureDraft_07_Justify avgt 2.8854 ms/op
measureDraft_07_Medeia avgt 1.7953 ms/op
measureDraft_07_NetworkNt avgt 2.5196 ms/op
measureDraft_07_SchemaFriend avgt 5.8124 ms/op
measureDraft_07_Snow avgt 7.5770 ms/op
measureDraft_07_Vertx avgt 3.9631 ms/op
measureDraft_2019_09_DevHarrel avgt 6.7369 ms/op
measureDraft_2019_09_NetworkNt avgt 4.1106 ms/op
measureDraft_2019_09_SchemaFriend avgt 4.5364 ms/op
measureDraft_2019_09_Snow avgt 20.029 ms/op
measureDraft_2019_09_Vertx avgt 7.2882 ms/op
measureDraft_2020_12_DevHarrel avgt 4.7750 ms/op
measureDraft_2020_12_NetworkNt avgt 4.0334 ms/op
measureDraft_2020_12_SchemaFriend avgt 4.0378 ms/op
measureDraft_2020_12_Skema avgt 5.9661 ms/op
measureDraft_2020_12_Vertx avgt 7.0690 ms/op

With Changes

Benchmark Mode Score Score Error (99.9%) Unit
measureDraft_03_SchemaFriend avgt 1.8594 ms/op
measureDraft_04_Everit avgt 1.6637 ms/op
measureDraft_04_Justify avgt 2.1567 ms/op
measureDraft_04_Medeia avgt 1.6925 ms/op
measureDraft_04_NetworkNt avgt 1.1802 ms/op
measureDraft_04_SchemaFriend avgt 2.2723 ms/op
measureDraft_04_Vertx avgt 2.7232 ms/op
measureDraft_06_Everit avgt 1.3924 ms/op
measureDraft_06_Justify avgt 1.8758 ms/op
measureDraft_06_Medeia avgt 1.1751 ms/op
measureDraft_06_NetworkNt avgt 1.0751 ms/op
measureDraft_06_SchemaFriend avgt 3.4659 ms/op
measureDraft_06_Snow avgt 10.816 ms/op
measureDraft_07_Everit avgt 1.5002 ms/op
measureDraft_07_Justify avgt 2.6362 ms/op
measureDraft_07_Medeia avgt 1.6215 ms/op
measureDraft_07_NetworkNt avgt 1.4285 ms/op
measureDraft_07_SchemaFriend avgt 4.8130 ms/op
measureDraft_07_Snow avgt 7.7367 ms/op
measureDraft_07_Vertx avgt 3.8086 ms/op
measureDraft_2019_09_DevHarrel avgt 5.4298 ms/op
measureDraft_2019_09_NetworkNt avgt 2.3978 ms/op
measureDraft_2019_09_SchemaFriend avgt 3.9927 ms/op
measureDraft_2019_09_Snow avgt 20.068 ms/op
measureDraft_2019_09_Vertx avgt 6.9539 ms/op
measureDraft_2020_12_DevHarrel avgt 4.7589 ms/op
measureDraft_2020_12_NetworkNt avgt 2.5706 ms/op
measureDraft_2020_12_SchemaFriend avgt 4.0046 ms/op
measureDraft_2020_12_Skema avgt 6.5409 ms/op
measureDraft_2020_12_Vertx avgt 6.7753 ms/op

@codecov-commenter
Copy link

codecov-commenter commented Jan 18, 2024

Codecov Report

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

Comparison is base (5a94df7) 79.04% compared to head (afe9d78) 78.64%.

Files Patch % Lines
...c/main/java/com/networknt/schema/RefValidator.java 70.00% 21 Missing and 9 partials ⚠️
src/main/java/com/networknt/schema/JsonSchema.java 82.35% 7 Missing and 8 partials ⚠️
...n/java/com/networknt/schema/JsonSchemaFactory.java 87.80% 3 Missing and 2 partials ⚠️
...n/java/com/networknt/schema/BaseJsonValidator.java 70.00% 3 Missing ⚠️
...va/com/networknt/schema/RecursiveRefValidator.java 57.14% 3 Missing ⚠️
...ava/com/networknt/schema/DiscriminatorContext.java 90.90% 0 Missing and 1 partial ⚠️
.../main/java/com/networknt/schema/EnumValidator.java 95.65% 0 Missing and 1 partial ⚠️
...ava/com/networknt/schema/NonValidationKeyword.java 90.90% 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     #922      +/-   ##
============================================
- Coverage     79.04%   78.64%   -0.41%     
- Complexity     1390     1432      +42     
============================================
  Files           134      136       +2     
  Lines          4515     4692     +177     
  Branches        868      896      +28     
============================================
+ Hits           3569     3690     +121     
- Misses          612      645      +33     
- Partials        334      357      +23     

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

@justin-tay justin-tay force-pushed the schemaresources_path_locale_master branch 2 times, most recently from a53c3eb to 8c467d8 Compare January 19, 2024 00:02
@justin-tay justin-tay force-pushed the schemaresources_path_locale_master branch from 8c467d8 to d356bdf Compare January 19, 2024 14:47
@justin-tay justin-tay force-pushed the schemaresources_path_locale_master branch from d356bdf to afe9d78 Compare January 19, 2024 15:03
@stevehu stevehu merged commit 9b73d10 into networknt:master Jan 20, 2024
4 checks passed
@stevehu
Copy link
Contributor

stevehu commented Jan 20, 2024

@justin-tay I have released 1.2.0 vesion. Thanks a lot for your help.

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