Skip to content

Handle "integer" properly in anyOf error handler #102

@jdesrosiers

Description

@jdesrosiers

In #101, we recognized the need for special handling for "integer" in the type error handler, which is a weird special case value for type. @srivastava-diya is working on handling that case properly, but it occurs to me that we do something similar in the anyOf error handler and we aren't handling "integer" properly there either.

Schema:

{
  "anyOf": [
    { "type": "integer" },
    { "type": "boolean" }
  ]
}

Instance:

"foo"

Current Result:

{
  "errors": [
    {
      "message": "Unexpected value ⁨\"foo\"⁩. ⁨Expected a ⁨\"boolean\"⁩.⁩",
      "instanceLocation": "#",
      "schemaLocation": "https://example.com/main#/anyOf"
    }
  ]
}

Expected Result:

{
  "errors": [
    {
      "message": "Unexpected value ⁨\"foo\"⁩. ⁨Expected an ⁨\"integer\" or \"boolean\"⁩.⁩",
      "instanceLocation": "#",
      "schemaLocation": "https://example.com/main#/anyOf"
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions