-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Bump com.networknt:json-schema-validator to 1.4.0 #393
Conversation
dependency version to 1.4.0. Signed-off-by: ywittmann <yan.wittmann@metaeffekt.com>
Unrelated, but why do you require the description to be wrapped at 72 characters? Just asking to understand. https://github.com/CycloneDX/.github/blob/0b572a6f8fc922c7ecc268dacb2c2ef33218838f/CONTRIBUTING.md |
hey, @YanWittmann this is something we were checking, did you notice something about response time when testing? after testing we saw that after this change the unit test for the JSON validator schema went from 5 to 120 seconds, we are investigating what could be the reason |
…mprove loading performance. Signed-off-by: Yan Wittmann <mail@yanwittmann.de>
I'm unsure how I didn't notice this before, but you're right. It takes much longer than before to build the project. Please view the new implementation of the protected JsonSchema newJsonSchema(final SchemaLocation schemaUri, final JsonNode schemaNode, final SchemaValidatorsConfig config) {
final ValidationContext validationContext = createValidationContext(schemaNode, config);
JsonSchema jsonSchema = doCreate(validationContext, getSchemaLocation(schemaUri),
new JsonNodePath(validationContext.getConfig().getPathType()), schemaNode, null, false);
if (config.isPreloadJsonSchema()) {
try {
/*
* Attempt to preload and resolve $refs for performance.
*/
jsonSchema.initializeValidators();
} catch (Exception e) {
/*
* Do nothing here to allow the schema to be cached even if the remote $ref
* cannot be resolved at this time. If the developer wants to ensure that all
* remote $refs are currently resolvable they need to call initializeValidators
* themselves.
*/
}
}
return jsonSchema;
} The By now simply adding a config.setPreloadJsonSchema(false); to the class I edited, this issue is resolved; all tests still pass (as is to be expected) and the runtime is once again down to 2.5 seconds for the test cases on my machine for both versions. I've pushed this change to my PR. Thanks for taking the time to review this! |
Hey @YanWittmann thanks for looking into it, I just checked, and indeed the test time is almost the same. |
+1 LGTM, thanks for contributing to the project |
cyclonedx-core-java/pom.xml
Line 186 in a452407
It would be nice if the dependency to
com.networknt:json-schema-validator:1.0.73
as found in the pom.xmlcould be upgraded to the latest 1.4.0, as one of our projects depends on
features in this latest version and therefore conflicts with the
dependency of this project.
This Pull Request implements the changes needed to use the
latest version of the json schema validator. More
specifically, it uses the new JSON Schema Mapper
format for creating the JsonSchemaFactory instance:
As can be seen in master...YanWittmann:cyclonedx-core-java-bump-validator:master#diff-fc28290f55c35403fc95b45ee2714337621f54b48caba5e01f08d5760b54139a
Also see all the rejected PRs by dependabot to bump the version,
most likely rejected because they introduced that new schema
mapper which breaks the current usage.