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

Issue type for wrong enum value types #318

Open
javagl opened this issue Nov 8, 2024 · 0 comments
Open

Issue type for wrong enum value types #318

javagl opened this issue Nov 8, 2024 · 0 comments

Comments

@javagl
Copy link
Contributor

javagl commented Nov 8, 2024

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.

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