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

allOf confusing error message #474

Closed
MiguelSavignano opened this issue Nov 17, 2022 · 1 comment · Fixed by #495
Closed

allOf confusing error message #474

MiguelSavignano opened this issue Nov 17, 2022 · 1 comment · Fixed by #495

Comments

@MiguelSavignano
Copy link

user.json

{
  "type": "object",
  "required": ["user"],
  "properties": {
    "user": {
      "allOf": [
        {
          "type": "object",
          "properties": {
            "name": { "type": "string" }
          }
        },
        {
          "type": "object",
          "properties": {
            "age": { "type": "integer" }
          }
        }
      ]
    }
  }
}

Example:

require "json-schema"

JSON::Validator.validate!("./user.json", user: {  name: "Jhon",  age: "1"  })

Should raise an exception because the age is not an integer, but the current message is:

 The property '#/user' of type object did not match all of the required schemas (JSON::Schema::ValidationError)

and should be an explicit messages like:

The property '#/user/age' of type string did not match the following type: integer (JSON::Schema::ValidationError)
@anupama-kumari
Copy link
Contributor

@MiguelSavignano I have tried addressing this above issue in this PR #495
Could you please check and help me get it merged.

@ekohl ekohl linked a pull request Jul 6, 2023 that will close this issue
@ekohl ekohl closed this as completed in #495 Jul 6, 2023
ekohl added a commit that referenced this issue Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants