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

anyOf 后代节点存在 $ref 无法正常回填数据 #59

Closed
lljj-x opened this issue Apr 15, 2021 · 1 comment
Closed

anyOf 后代节点存在 $ref 无法正常回填数据 #59

lljj-x opened this issue Apr 15, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@lljj-x
Copy link
Owner

lljj-x commented Apr 15, 2021

如下schema,选择第二个option后 编辑无法回填数据

{
    "title": "演示:anyOf",
    "type": "object",
    "definitions": {
        "userId": {
            "title": "通过用户id设置",
            "type": "object",
            "properties": {
                "idCode": {
                    "type": "string",
                    "title": "ID",
                    "default": "10086"
                }
            }
        }
    },
    "oneOf": [
        {
            "title": "无动作",
            "properties": {
                "noAction": {
                    "type": "object",
                    "properties": {},
                    "title": "无"
                }
            }
        },
        {
            "title": "userId",
            "properties": {
                "userId": {
                    "$ref": "#/definitions/userId"
                }
            }
        }
    ]
}

--- 来自qq群

@lljj-x
Copy link
Owner Author

lljj-x commented Apr 15, 2021

原因由于在 匹配当前option的时候,会构造新的schema去匹配当前option但丢失了 definitions 属性

最后导致schema 无法正常resolve 到 $ref 数据。

@lljj-x lljj-x closed this as completed in 4dd046b Apr 15, 2021
@lljj-x lljj-x added the bug Something isn't working label Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant