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

jsonschema rules for array type does not get all applied during validation #89

Open
rafaellichen opened this issue Apr 9, 2024 · 0 comments

Comments

@rafaellichen
Copy link

the json schema definition:

{
    "type": "object",
    "definitions": {
        "type": {
            "type": "string",
            "enum": [
                "object",
                "boolean",
                "integer",
                "number",
                "string"
            ]
        },
        "enum": {
            type: "array",
            uniqueItems: true,
            items: { type: "string" },
            minItems: 1,
        }
    },
    "properties": {
        "type": {
            "$ref": "#/definitions/type"
        },
        "enum": {
            "$ref": "#/definitions/enum"
        }
    },
    "patternProperties": {
        "^.*$": {
            "properties": {
                "type": {
                    "$ref": "#/definitions/type"
                },
                "enum": {
                    "$ref": "#/definitions/enum"
                }
            },
            "additionalProperties": {
                "$ref": "#"
            }
        }
    }
}

and how i initialized the editor

const state = EditorState.create({
    doc: doc,
    extensions: [
        minimalSetup,
        lineNumbers(),
        bracketMatching(),
        closeBrackets(),
        linter(jsonParseLinter(), { delay: 0 }),
        lintGutter(),
        keymap.of([indentWithTab]),
        indentUnit.of("    "),
        json(),
        onUpdate,
        jsonSchema(...);
    ]
})

the enum array is not being fully validated, enum: type: array and enum: minItems: 1 work, but enum: uniqueItems: true and enum: items: type: string are not being enforced.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant