Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support data instead of $data #116

Open
gregsdennis opened this issue Sep 22, 2022 · 0 comments
Open

Support data instead of $data #116

gregsdennis opened this issue Sep 22, 2022 · 0 comments

Comments

@gregsdennis
Copy link

gregsdennis commented Sep 22, 2022

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant