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

multiple schema documents #7

Closed karenetheridge closed 4 years ago

karenetheridge commented 4 years ago

https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.8.2.4.5

karenetheridge commented 4 years ago

For using the test suite (via Test::JSON::Schema::Acceptance), see the 'additional_resources' attribute, where referenced content can be found.

Since we are not yet supporting loading resources directly, all of the files (recursively) under this directory should be directly added to the JS instance using the base URI 'http://localhost:1234'.

karenetheridge commented 4 years ago

Consider: when an error is encountered while evaluating the schema (for example the wrong type found under a keyword), an 'invalid' flag should be set on the entire document and all $ids indexed to that document should be removed.

see https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.8.2.4.4

karenetheridge commented 4 years ago

These should all be supported, whether or not loading from the network is implemented/enabled:

$js->evaluate($data, $document_object);
$js->evaluate($data, 'https://json-schema.org/draft/2019-09/schema'); # load from internal cache
$js->evaluate($data, 'https://foo.bar.com/schema.json');              # requires $js->add_schema(...) first, or a previous ->evaluate call involving a schema resource whose $id resolves to this URI
$js->evaluate($data, 'https://foo.bar.com/schema.json#/$defs/foo');   # ""
$js->evaluate($data, 'https://foo.bar.com/schema.json#some_id');      # ""
karenetheridge commented 4 years ago

Somewhat implemented in version 0.004 (commit 5c520e6ae6ce3c92ddc55cd034aa8d02d40eb559), but there is no ability yet to manually add additional documents.

karenetheridge commented 4 years ago

This is now done in version 0.006.