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

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

Open karenetheridge opened 1 year ago

karenetheridge commented 1 year ago

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.)

karenetheridge commented 10 months ago

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