Skip to content

$ref (and kin) across schema versions #808

Closed
@gregsdennis

Description

@gregsdennis

The spec doesn't define (and also doesn't mention that the behavior is undefined) how the reference keywords (e.g. $ref) work when referencing into schemas declaring other spec versions.

Example 1

I define schema http://my.com/schema as a draft 7 schema, but I need to reference schema http://that.one.guy.com/schema for one of my properties. Happily, that guy's schema is also defined at draft 7.

One day in the not-to-distant future, that guy upgrades their schema to draft 2019-09. Now my draft 7 schema (without being altered) references a draft 2019-09 schema.

Example 2

I define schema http://my.com/schema as a draft 7 schema, but I need to reference schema http://that.one.guy.com/schema for one of my properties. Happily, that guy's schema is also defined at draft 7.

One day in the not-to-distant future, I upgrade my schema to draft 2019-09, but it still references a draft 7 schema, which I don't control.


How is the validator supposed to handle this?

Ideally, I'd think the validator would take each schema document separately, and (if it supports the draft declared by the document, otherwise error) it would evaluate the reference under the draft it declares. However, I can see where a validator would get this wrong and evaluate the entire reference tree based on the draft declared by the root schema.

This should be either defined or explicitly stated that it's undefined.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions