You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This exposes hooks for the `contentEncoding` and `contentMediaType`
keywords, similar to the existing custom formats behavior. The provided
callables must return a tuple comprised of a validation boolean and
annotation of any type. The validation boolean is ignored in draft
2019-09 and 2020-12, because the [specification][0] says:
> They do not function as validation assertions; a malformed string-encoded document MUST NOT cause the containing instance to be considered invalid.
Drafts 7 and earlier will return a validation error based on the
validation boolean. From the [specification][1]:
> Implementations MAY support the "contentMediaType" and "contentEncoding" keywords as validation assertions.
All drafts forward the returned annotation as an annotation in the
overall result.
I don't love the API here, since it requires returning an array even
when it's ignored in the latest drafts, but I couldn't come up with
anything better.
Closes: #137
[0]: https://json-schema.org/draft/2020-12/json-schema-validation#section-8.1
[1]: https://json-schema.org/draft-07/draft-handrews-json-schema-validation-01#rfc.section.8.2
0 commit comments