-
Notifications
You must be signed in to change notification settings - Fork 264
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
Getting an Error with Schema <'+ourBase+'> already exists with different definition #360
Comments
Can you please provide running code, and describe the expected output and actual output? The example you posted has two sub-schemas that specify an id of Consider giving different, full URIs to each sub-schema e.g. |
The expected output is that it should be successfully validated. Ill give you an example of both the json and the schema. Schema
|
JSON: { |
Sorry one other thing is we are not allowed to modify the schema. When we use an online json schema validator it works perfectly fine. |
@makdataproj Unfortunately, looking at the full schema you posted, it has ambiguous behavior. Not only is There's no standard behavior on how to handle a schema that re-defines an existing $id. This library simply throws an error in this situation, because if it picked the wrong sub-schema definition, this would be difficult to debug later. (It could also indicate someone trying to maliciously bypass validation.) You're going to have to report this as an error in the schema. And also potentially report this upstream to the online validator, which should be providing stronger guarantees about which schemas are widely compatible. |
If you link me to the online validator you're using, I can check it out for you. |
Used https://www.jsonschemavalidator.net/ Added the same schema and the json I posted to validate. |
I am getting an issue with this schema as well, if you could please check what the possible issues are and why it's not working with jsonschema: {
} |
@makdataproj That post is too long for me to know where to start. Can you please post a code example, along with expected and actual output? It would be best if you can make the example as small as possible. |
Please see attached the error I am getting. I dont know if it is the schema: https://github.com/CycloneDX/specification/blob/master/schema/bom-1.4.schema.json or the if the json: https://pastebin.com/pfsv4BDe is not valid? Just want to make sure it is not the schema. This is the code snippet for the validation:
|
Getting an error: throw new Error('Schema <'+ourBase+'> already exists with different definition');;
There are two fields that have multiple same entries for $id but it is giving the error message above. However it validates fine on other json schema tools.
Example:
The text was updated successfully, but these errors were encountered: