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

[FEATURE] jsonschema 支持递归引用 #1766

Closed
shpodg opened this issue Aug 18, 2023 · 3 comments
Closed

[FEATURE] jsonschema 支持递归引用 #1766

shpodg opened this issue Aug 18, 2023 · 3 comments
Labels
enhancement New feature or request fixed
Milestone

Comments

@shpodg
Copy link

shpodg commented Aug 18, 2023

支持如下格式的jsonschema解析

{
  "$defs": {
    "person": {
      "type": "object",
      "properties": {
        "name": { "type": "string" },
        "children": { "$ref": "#/$defs/personList" }
      }
    },
    "personList": {
      "type": "array",
      "items": { "$ref": "#/$defs/person" }
    }
  },
  "type": "object",
  "properties": {
    "family": { "$ref": "#/$defs/person" }
  }
}

当前使用版本2.0.39
解析后的schema对如下json进行校验报错

{"family":{"name":"1","children":[{"name":"2"}]}}

报错信息

com.alibaba.fastjson2.JSONSchemaValidException: property family invalid; property children invalid; not fail

查看解析后的schema发现如下内容,循环引用的部分被解析成为了not any
image

@shpodg shpodg added the enhancement New feature or request label Aug 18, 2023
wenshao added a commit that referenced this issue Aug 19, 2023
@wenshao
Copy link
Member

wenshao commented Aug 19, 2023

支持的啊,你遇到什么问题了

@shpodg
Copy link
Author

shpodg commented Aug 19, 2023

支持的啊,你遇到什么问题了

问题信息已经补充

@wenshao wenshao added this to the 2.0.40 milestone Aug 26, 2023
@wenshao wenshao modified the milestones: 2.0.40, 2.0.41 Sep 3, 2023
@wenshao wenshao added the fixed label Oct 5, 2023
@wenshao
Copy link
Member

wenshao commented Oct 6, 2023

https://github.com/alibaba/fastjson2/releases/tag/2.0.41
问题已修复,请用新版本

@wenshao wenshao closed this as completed Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed
Projects
None yet
Development

No branches or pull requests

2 participants