Replies: 1 comment 1 reply
-
| 
         The   | 
  
Beta Was this translation helpful? Give feedback.
                  
                    1 reply
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm really struggling with this and any clues as to where I might be going wrong will be greatly appreciated.
I am trying to validate a YAML file using a custom JSON schema. However, my schema,
test-schema.jsonreferences definitions from another file,base-schema.json. This is a common pattern which I have used a lot in the past to keep definitions re-usable. However, this is the first time I'm trying to programmatically validate using this library and facing issues.test-schema.json
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.org/schemas/test-schema.json", "type": "object", "properties": { "test": { "allOf": [ { "$ref": "base-schema.json#/$defs/Definition" }, { "type": "object", "properties": { "three": { "type": "string" } } } ], "additionalProperties": false } } }base-schema.json
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.org/schemas/base-schema.json", "$defs": { "Definition": { "type": "object", "properties": { "one": { "type": "string" }, "two": { "type": "string" } } } } }Java test
When I run the above, I simply get these errors:
It's as if the validator isn't able to understand that the
Definitiondefinition is defined in another schema file and therefore theallOfis mysteriously failing.Any help is appreciated. Thank you.
Beta Was this translation helpful? Give feedback.
All reactions