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

optionally permit loading external resources #15

Open karenetheridge opened 4 years ago

karenetheridge commented 4 years ago

e.g. from disk or the network. requires #7.

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.

All of the files (recursively) under this directory should be made available under the URI 'http://localhost:1234'. (Either create a standalone http server on localhost:1234, or create a local useragent to be provided to the implementation which only answers to requests made to resources using that URI.)

karenetheridge commented 4 years ago
karenetheridge commented 4 years ago

if a $ref is encountered to an unknown resource, then the uri must be absolute for it to be loadable -- because the scheme is needed to determine how the fetch is done.

karenetheridge commented 4 years ago

when loading YAML files, set $YAML::XS::Boolean = 'JSON::PP'.

karenetheridge commented 4 years ago

loading with YAML::XS will not give us proper NVs and IVs until https://github.com/ingydotnet/yaml-libyaml-pm/issues/68 is resolved.

karenetheridge commented 4 years ago

YAML workaround, for now:

use YAML::PP;
my $schema = YAML::PP->new(boolean => 'JSON::PP')->load_file($filename);
karenetheridge commented 3 years ago

see §9.5.1.3 - when fetching a URI resource, set the User-Agent and From headers appropriately, and use/respect caching headers (potentially storing those headers in the Document object as an attribute)

karenetheridge commented 2 years ago

Need to keep an object-scoped list of the stack of URIs in progress of being loaded -- so we don't run into circular references.