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

Enum validation #803

Closed
1 task done
marcelosousa opened this issue Jul 24, 2022 · 2 comments
Closed
1 task done

Enum validation #803

marcelosousa opened this issue Jul 24, 2022 · 2 comments
Assignees
Milestone

Comments

@marcelosousa
Copy link

Describe the bug

I'm getting unexpected behaviour with the validation of the schema when it comes to enums.

For example, consider the following schema:

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "definitions": {
        "rule": {
            "description": "A rule.",
            "type": "object",
            "properties": {
                "kind": {
                    "description": "The kind of a rule.",
                    "type": "string",
                    "enum": [
                        "tested"
                    ]
                }
            },
            "required": [
                "kind"
            ],
            "additionalProperties": false
        }
    },
    "properties": {
        "rules": {
            "description": "Rule list",
            "type": "array",
            "items": {
                "$ref": "#/definitions/rule"
            },
            "minProperties": 1,
            "additionalProperties": false
        }
    }
}

And the following YML file:

rules:
  - kind: test

Expected Behavior

We should get an error in test as it is not an element of the enum.

Current Behavior

No error. It seems that as long it is as prefix of an element in the enum, the validation succeeds.

Environment

  • Mac
@msivasubramaniaan
Copy link
Contributor

Issue has been resolved and it will be available on the next v1.10.0

@marcelosousa
Copy link
Author

Many thanks @msivasubramaniaan 🙌

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

2 participants