And it does not even validate aigain successfully:
puts JSON::Validator.fully_validate(schema, json)
The property '#/formats/1' of type Hash did not match any of the required schemas. The schema specific errors were:
- oneOf #0:
- The property '#/formats/1' contains additional properties ["order"] outside of the schema when none are allowed
- oneOf #1:
- The property '#/formats/1' contains additional properties ["scale"] outside of the schema when none are allowed
- The property '#/formats/1/encoding' value "ascii" did not match one of the following values: binary
Which leads me to think that there are in fact 2 issues:
The defaults are only added after the data has already been validated
schema selection via oneOf is not applied before adding defaults
I have a schema with an array of oneOf $refs :
Here is valid data against the schema:
Here is the validation part:
This generates wrongly added default data to the json variable:
This is how it should be:
And it does not even validate aigain successfully:
Which leads me to think that there are in fact 2 issues:
The complete code can be found here: https://gist.github.com/lumpidu/e5ee62b46b16cdc688d1