opis / json-schema

JSON Schema validator for PHP
https://opis.io/json-schema
Apache License 2.0
568 stars 58 forks source link

Support `data` instead of `$data` #116

Open gregsdennis opened 2 years ago

gregsdennis commented 2 years ago

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: