Skip to content

Use referencing for resolve.py's URI and retrieval layer #119

Description

@LukasOro

src/oold/validation/resolve.py is about 500 lines covering document loading, $ref dereferencing and schema bounding. referencing is already a dependency and is already used for the meta-schema registry in src/oold/validation/meta_store.py, so part of this is hand-rolled where a library the project already ships would do.

What the module does, and what referencing covers

Responsibility Covered by referencing
Normalise dict / Path / str / JSON text / URL to a base URI yes, largely
Remote fetch with disk cache and offline=True no
dereference() producing a materialised graph with shared and circular refs no, resolution is lazy during validation
bound_schema() cutting that graph into a finite tree no

The last two are why the module exists in this form: instance generation and round-trip need a concrete finite document, not lazy lookup at validation time.

Work

  • Move the URI normalisation and retrieval layer onto referencing, keeping Resolver's cache and offline behaviour as the retrieve hook
  • Leave dereference() and bound_schema() in place unless a replacement provides the same graph semantics
  • Measure the reduction; if it is small, close this and record why

Constraint

$ref resolution feeds every check, so all parity verdicts must be re-checked: OOLD_SCHEMA_DIR=../oold-schema uv run pytest -m parity. Cut markers from bound_schema() are observable in generated instances, so the round-trip fixtures are also a gate.

Raised from review of #114 (comment).

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions