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

[BUG] I think this is a bug about dependencies #905

Closed
CrystalWyz opened this issue Dec 6, 2023 · 0 comments
Closed

[BUG] I think this is a bug about dependencies #905

CrystalWyz opened this issue Dec 6, 2023 · 0 comments

Comments

@CrystalWyz
Copy link

this is my jsonschema

{
    "allOf":
    [
        {
            "else":
            {
                "required":
                []
            },
            "then":
            {
                "required":
                [
                    "b"
                ]
            },
            "if":
            {
                "properties":
                {
                    "a":
                    {
                        "contains":
                        {
                            "const": "1",
                            "type": "string"
                        },
                        "type": "array"
                    }
                }
            }
        },
        {
            "else":
            {
                "required":
                []
            },
            "then":
            {
                "required":
                [
                    "c"
                ]
            },
            "if":
            {
                "properties":
                {
                    "a":
                    {
                        "contains":
                        {
                            "const": "2",
                            "type": "string"
                        },
                        "type": "array"
                    }
                }
            }
        }
    ],
    "type": "object",
    "properties":
    {
        "a":
        {
            "type": "array",
            "message":
            {
                "type": "下拉组件必须是array类型"
            },
            "items":
            {
                "type": "string"
            }
        },
        "b":
        {
            "type": "string",
            "message":
            {
                "type": "b组件必须是字符串类型",
                "maxLength": "组件长度最大支持50位"
            },
            "maxLength": 50
        },
        "c":
        {
            "type": "string",
            "message":
            {
                "type": "c组件必须是字符串类型",
                "maxLength": "组件长度最大支持50位"
            },
            "maxLength": 50
        }
    },
    "required":
    [
        "a"
    ],
    "dependencies":
    {
        "b":
        {
            "allOf":
            [
                {
                    "properties":
                    {
                        "a":
                        {
                            "contains":
                            {
                                "const": "1",
                                "type": "string"
                            },
                            "type": "array"
                        }
                    }
                }
            ]
        },
        "c":
        {
            "allOf":
            [
                {
                    "properties":
                    {
                        "a":
                        {
                            "contains":
                            {
                                "const": "2",
                                "type": "string"
                            },
                            "type": "array"
                        }
                    }
                }
            ]
        }
    }
}

this is my data

{
    "a": [
        "2"
    ],
    "c": "45"
}

It should pass the verification, but it prompted me that a is missing "1", but I did not pass the value of b.

@CrystalWyz CrystalWyz changed the title I think this is a bug about dependencies [BUG] I think this is a bug about dependencies Dec 6, 2023
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