karenetheridge / JSON-Schema-Modern

Validate data against a schema using a JSON Schema
https://metacpan.org/release/JSON-Schema-Modern/
Other
10 stars 1 forks source link

support 'format' vocabulary as assertions #14

Closed karenetheridge closed 4 years ago

karenetheridge commented 4 years ago

potentially depends on #13 (if enabling this via the $vocabulary keyword); but this can also be enabled via a direct config option.

A schema can specify it wishes 'format' declarations to be treated as assertions, not just annotations.

https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.7.1

Requires finding validation implementations of all the specified formats: https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.7.3

karenetheridge commented 4 years ago

The validators can be added individually, as developer time permits; when assertion behaviour is requested and a particular format is not implemented yet, we should die (issue an error that immediately aborts execution with a special message).

It should also be possible to provide additional format processors directly to the implementation; the easiest and most obvious way would be to pass a hash of format names => implementation subrefs.

karenetheridge commented 4 years ago

When implementing email addresses:

karenetheridge commented 4 years ago

This is now done in version 0.006.