-
Notifications
You must be signed in to change notification settings - Fork 331
Support for $ref external schema references? #55
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
Comments
{"$ref": "CVE_JSON_4.0_min.schema"} cannot be resolved normally as json schema reference should be a uri. If you are using the uri (https://scap.nist.gov/schema/nvd/feed/0.1/CVE_JSON_4.0_min.schema) it should work. If you want to refer to local filesystem, you need to take a look at #45 |
Thank you. I will try this and report back. |
Hello. I've used version 0.1.3 with $ref external schemas without any problem. Today I decided to upgrade to 0.1.13 and I received the following error:
in my json schema I have something like this is this not working anymore? |
I managed to make it work. Also I think there is a bug on https://github.com/networknt/json-schema-validator/blob/master/src/main/java/com/networknt/schema/RefValidator.java line 94
This requires for the id to contain at least one "/" charater, which in my opinion is wrong I could simply have an id like this I easy fix this because I put all my .json files in a folder and defined the id like this: |
@2beers The previous version is implemented as schema v4 and now it is more close to v6 in $ref implementation. I am planning to rewrite this library so that users can choose which validator to use v4 or v6 but never got enough time to commit. The idea is to use light-4j service module to inject different implementations in a service.yml file. It would be very easy for customization as well. Take a look at openapi-parser validator implementation for example. |
I've never tried light-4j so I can't comment, however I think you should add a condition where the id doesn't contain any "/" character to avoid throwing errors. |
@2beers could you please create a pull request? Thanks. |
This issue should be resolved by PR #141 |
We have a schema that refers to three other schemas using $ref. The others are at the same relative path (folder). Trying to resolve by URL. The first schema is:
https://scap.nist.gov/schema/nvd/feed/0.1/nvd_cve_feed_json_0.1_beta.schema
The others are
https://scap.nist.gov/schema/nvd/feed/0.1/cvss-v3.0.json
https://scap.nist.gov/schema/nvd/feed/0.1/cvss-v2.0.json
https://scap.nist.gov/schema/nvd/feed/0.1/CVE_JSON_4.0_min.schema
Getting warning in log:
16:27:08,402 WARN [com.networknt.schema.JsonMetaSchema] (quartzScheduler_Worker-1) Could not load validator $ref
Any tips for troubleshooting? Is $ref supported by json-schema-validator? Nice library BTW, it has saved us a lot of time.
The text was updated successfully, but these errors were encountered: