boon icon indicating copy to clipboard operation
boon copied to clipboard

Explicitly disable format assertions

Open michaelmior opened this issue 1 year ago • 2 comments

There doesn't seem to be a way to explicitly disable format assertions. I am using a draft-07 schema and I would like to have format assertions disabled but there doesn't seem to be a method to do so.

michaelmior avatar Jan 16 '25 14:01 michaelmior

as per draft-07, they cannot be disabled. but you can achieve this with following hack

you can override the default format implementations using compiler.registerFormat method which does nothing. you can see list of default formats supported in https://github.com/santhosh-tekuri/boon/blob/main/src/formats.rs#L24

note that still you can't override regex format

santhosh-tekuri avatar Jan 26 '25 15:01 santhosh-tekuri

draft-07 indicates that format does not need to be implemented as an assertion. It's up to the implementation. That said, boon implementing them as assertions is valid according to the spec, but it would be helpful to have the ability to make this behavior optional.

The "format", "contentType", and "contentEncoding" keywords can also be implemented as assertions, although that functionality is an optional part of this specification, and the keywords convey additional non-assertion information.

michaelmior avatar Jan 27 '25 17:01 michaelmior