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

Validating a schema against meta-schema ignores unknown properties added to required #346

Open
sakthiiv opened this issue Jun 25, 2020 · 0 comments

Comments

@sakthiiv
Copy link

sakthiiv commented Jun 25, 2020

Hello, Thank you for developing this awesome library.

Describe the bug
Validating schema against a meta-schema doesn't throw any error when the properties listed in the required are not part of the property definition

To Reproduce
I am trying to validate the below schema against draftV4 meta-schema, the validation is getting succeded without any error being thrown,

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "schema-test",
  "properties": {
    "data": {
      "properties": {
        "created": {
          "type": [
            "string"
          ]
        }
      },
      "required": [
        "created",
        "updated"
      ],
      "type": "object"
    }
  },
  "required": [
    "data"
  ]
}

updated property is not available in the properties definition. This validation is a success even though it was not part of the properties

Expected behavior
An exception to be thrown when the required properties are not available in the property definition.

Additional context
When the payload is verified against the schema, an error is thrown object has missing required properties ([\"updated\"])

{
  "data": {
    "created": "User A"
  }
}

Is there a way to identify the required properties that are not available in the schema when it is compared with meta-schema?

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