Skip to content

Issue type for wrong enum value types #318

@javagl

Description

@javagl

A low-level detail, rather an internal note:

When there is an enum definition like

        "exampleEnum": {
          "type": "string",
          "enum": [
            "VALUE_A",
            "VALUE_B"
          ]

and the JSON input contains something like
exampleEnum: 12345
then this is reported as
VALUE_NOT_IN_LIST: The 'exampleEnum' property has the value 12345, but must be one of VALUE_A,VALUE_B

This is correct and reasonable.

One could make a case that this should be reported as a
TYPE_MISMATCH: The 'exampleEnum' property must have type 'string', but has type 'number'

But I think that this is a special case, where the type itself does not matter so much, and the details (i.e. the allowed values) add valuable information that justify using the more specific VALUE_NOT_IN_LIST issue.

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