Skip to content

Allow different $schema values in same document if different resources #850

Closed
@handrews

Description

@handrews

Currently, you can put $schema in a resource root object, which means you can have multiple $schema keywords in the same document. Currently we say that schema authors SHOULD only have $schema in the document root, and we say that if multiple resources in the same schema have different $schema values, the meta-schema is undefined. There's a CREF giving some of the backstory.

Before the schema resource concept was introduced, and tied to the updated $id keyword, there was concern about allowing $schema to be dropped into any random schema object.

But now we have two types of schema objects: schema resource root objects, and schema objects within a resource. The document root object is a special case of the schema root object.

Schema resource roots are easily detected ($id means its a schema resource root), and we already do special processing of them. Allowing the $schema to change there makes sense, as we want schema resources to behave the same whether they are linked with $ref (in which case you can definitely change $schema) or not (which is currently undefined).

I think we should go ahead and define this behavior. It also fits in with #849 (clarifying and consolidating the schema loading process), where we will talk about how to load embedded schema resources within a single document.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions