ropensci / jsonvalidate

:heavy_check_mark::interrobang: Validate JSON
https://docs.ropensci.org/jsonvalidate
Other
49 stars 14 forks source link

Support options for `ajv` #75

Open AlexAxthelm opened 1 year ago

AlexAxthelm commented 1 year ago

Hi,

I'm interested in using jsonvalidate for my projects, and one of the features that would be really helpful from ajv is being able to fill in default values from the schema.

Doing so would require being able to set the useDefaults option for ajv. Is there a way to pass options other than strict to json_schema$new() without using a modified version of in.js?

richfitz commented 1 year ago

That's an interesting option, I can see that would be useful. There is not a way without modifying in.js - if you have the capacity/ability to create a PR that adds this functionality I can review it and get it added to the package, otherwise I will look at this next time I do some work on the package. It's probably not that much work to implement in practice, if the argument moves though in the same way as strict but unmarshalling json from R always throws up some odd cases