Skip to content

Support data instead of $data #116

@gregsdennis

Description

@gregsdennis

Your implementation of the $data keyword results in invalid schemas (they fail validation against the meta-schema).

For example

{
  "type": "integer",
  "minimum": { "$data": "/minValue" }
}

violates that the value in minimum is supposed to be a number.

Please consider implementing my data vocabulary instead. It is fully compliant with drafts 6 and later. It's also more powerful in that it can reference data from the instance, from the schema, and from other external sources.

Edit I thought that it might be good to include what this would look like with data.

{
  "type": "integer",
  "data": {
    "minimum": "/minValue"
  }
}

This schema does pass meta-schema validation.

To reference other data sources, use:

  • plain JSON Pointers to reference instance data (as shown above)
  • URI-encoded JSON Pointers as fragment-only URIs to reference schema data (e.g. #/minValue, like what you might see in $ref)
  • full URIs, optionally with JSON Pointer fragments to reference other external data (e.g. https://example.com/data#/my/pointer)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions