Open ahx opened 2 weeks ago
Ha! I've found a solution.
configuration = JSONSchemer::Configuration.new(insert_property_defaults: true)
doc = JSONSchemer.openapi(resolved, configuration:)
content_schema = doc.ref('/components/schemas/MySchema')
content_schema.validate(data) # Succeeds!
Thanks! 🦆 Feel free to close this issue.
Hi. What I would like to do is to use
insert_property_defaults: true
for subschemas that are adressed viaSchema#ref
without globally changingJSONSchemer.configuration
. But currently that does not seem to be possible, becauseSchema#ref
does not apply the custom local options, but only uses the global configuration and passinginsert_property_defaults: true
toSchema#validate
is not supported.Here is an example:
If you have a suggestion for an API to solve this, I'd be happy to try to create a PR for that.