karenetheridge / JSON-Schema-Modern

Validate data against a schema using a JSON Schema

Home Page:https://metacpan.org/release/JSON-Schema-Modern/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

linting feature: traverse a schema for $refs, and identify any that reference unknown resource locations

karenetheridge opened this issue · comments

When processing a schema, it can be helpful to know if there are any internal references to other schema documents, in order to determine if anything needs to be fetched from the network/disk/whatever in advance of evaluation (because we don't fetch documents in realtime).

This can be done easily enough with a traverse call with a $ref callback that knows how to resolve references. It could present the result as two lists of absolute URIs - those that are "known" and those that are not.

(This same method could then be reimplemented on the subclass, JSON::Schema::Modern::Document::OpenAPI, with special knowledge of how to traverse openapi documents.)

This can be done after #51, which involves tracking all known schema locations in a document.