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

"additionalProperties: false" is ignored if type specified in array #404

Open
elasti-ron opened this issue Feb 11, 2018 · 0 comments
Open

Comments

@elasti-ron
Copy link

Given the object

object = {
  "a_string": "this property is allowed by the schema",
  "an_extra_string": "the schema does not allow this property"
}

The following schema should raise a validation error but doen't:

// should raise error but doesn't
{
  "type": [ "object", "null" ],
  "properties": {
    "a_string": {
      "type": "string"
    }
  },
  "additionalProperties": false
}

This occurs even if only a single type is specified in the array of type options:

// should raise error but doesn't
{
  "type": [ "object" ],
  "properties": {
    "a_string": {
      "type": "string"
    }
  },
  "additionalProperties": false
}

Note that this does not occur when the type is specified directly and not in an array. In other words, the following schema does raise the expected error:

// raises error as expected
{
  "type": "object",
  "properties": {
    "a_string": {
      "type": "string"
    }
  },
  "additionalProperties": false
}

This issue may be related to #369

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