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]FastJson2, JsonSchema, type为数组问题 #2931

Closed
leicen opened this issue Sep 5, 2024 · 1 comment
Closed

[BUG]FastJson2, JsonSchema, type为数组问题 #2931

leicen opened this issue Sep 5, 2024 · 1 comment
Labels
bug Something isn't working fixed
Milestone

Comments

@leicen
Copy link

leicen commented Sep 5, 2024

问题描述

简要描述您碰到的问题。

FastJson2, JsonSchema, type为数组问题时,JsonSchema对象被处理为 x: {}

示例:
public static void main(String[] args) throws IOException {

    // 定义必须包含longitude和latitude两个属性,其中longitude的取值范围是[-180 ~ 180],latitude的取值范围是[-90, 90]
    JSONSchema schema = JSONSchema.of(JSON.parseObject("{\"type\":\"object\",\"properties\":{\"longitude\":{\"type\":[\"string\", \"number\"]},\"latitude\":{\"type\":\"number\",\"minimum\":-90,\"maximum\":-90}},\"required\":[\"longitude\",\"latitude\"]}"));

    // 校验JSONObject对象,校验通过
    System.out.println(schema);
}

结果:

{"type":"object","properties":{"longitude":{},"latitude":{"type":"number","minimum":-90,"maximum":-90}},"required":["longitude","latitude"]}

@leicen leicen added the bug Something isn't working label Sep 5, 2024
@wenshao wenshao added this to the 2.0.53 milestone Sep 15, 2024
@wenshao wenshao added the fixed label Sep 15, 2024
@wenshao
Copy link
Member

wenshao commented Sep 16, 2024

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

@wenshao wenshao closed this as completed Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

2 participants