-
Notifications
You must be signed in to change notification settings - Fork 318
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
Updating the version for com.networknt json-schema-validator from 1.0.74 to 1.3.2 runs into error for : Reference /definitions/testDocument cannot be resolved #964
Comments
It's hard to say since you didn't show your schema. If If |
@justin-tay I'm trying to upgrade from 1.0.64 to 1.4.0 and seeing the same issue. My schema is like the follows:
The json schema validator complains: If I paste the schema to an online json schema validator, I receive errors as well. Was it a bug in |
There are plenty of issues in Putting In your example, all your |
Thanks for the answer @justin-tay. The upper level However, I encountered another error. I have some json schema documents defined under a main.json
child.json
child2.json
Folder structure:
Is there something wrong with the way how I load the schemas? I use the following:
|
Your After removing all your JsonSchemaFactory factory = JsonSchemaFactory.getInstance(VersionFlag.V201909);
JsonSchema schema = factory.getSchema(SchemaLocation.of("classpath:/main/main.json"));
String inputData = "{\r\n"
+ " \"fields\": {\r\n"
+ " \"ids\": {\r\n"
+ " \"value\": {\r\n"
+ " \"value\": 1\r\n"
+ " }\r\n"
+ " }\r\n"
+ " }\r\n"
+ "}";
System.out.println(schema.validate(inputData, InputFormat.JSON, OutputFormat.HIERARCHICAL)); |
I was previously using the following version of the JSON Schema Validator and everything was working fine when I was validating the JSON against the respective JSON Schema:
com.networknt
json-schema-validator
1.0.74
Following is the code I have for
1.0.74
version:With its test case:
The above-provided code works perfectly fine and is able to identify any issues that may be present in JSON by validating against the JSON Schema.
Now I only changed the version from
1.0.74
to latest version1.3.2
for the Schema validator:Based on this change I had to change the
objectMapper
tojsonMapper
while creating the instance of the factory:Apart from this everything remains the same including the JSON document provided as input and JSON schema but when I run this test then I get the following error:
Can anyone please let me know what needs to be modified based on the version update? I am unable to find anything on the web.
The text was updated successfully, but these errors were encountered: