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

Conditionally applying subschemas not working #149

Closed
leecheve opened this issue Jun 6, 2019 · 2 comments
Closed

Conditionally applying subschemas not working #149

leecheve opened this issue Jun 6, 2019 · 2 comments

Comments

@leecheve
Copy link

leecheve commented Jun 6, 2019

JSON schema draft-07 introduces if,then,else keywords to allow the application of a subschema based on the outcome of another schema. The following schema doesn't conditionally apply the subschema: If the "foo" property equals "bar", then the "baz" property is required

test.schema.json

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "foo": { "type": "string" },
    "baz": { "type": "string" }
  },
  "if": {
    "properties": {
      "foo": { "const": "bar" }
    }
  },
  "then": { "required": ["baz"] },
}

test.yml

foo: bar
@JPinkney
Copy link
Contributor

JPinkney commented Jun 6, 2019

We have not released since #147 has been merged so the support is still only up to JSON Schema 4. It will be JSON Schema 7 after our next release.

@JPinkney
Copy link
Contributor

This should be now working as of 0.7.0.

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

2 participants