alibaba / alibaba/fastjson2

[BUG] jsonschema maximum 提示文案错误

Open
#1,854 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

### 问题描述
maximum not match, expect >= %s, but %s

### 环境信息
- 版本信息:Fastjson2 2.0.40

### 重现步骤
```java
final JSONSchema jsonSchema = JSONSchema.of(JSONObject.of("type", "integer", "maximum", 10));
jsonSchema.assertValidate(11);
```

### 期待的正确结果
maximum not match, expect <= 10, but 11

### 相关日志输出
com.alibaba.fastjson2.JSONSchemaValidException: maximum not match, expect >= 10, but 11
at com.alibaba.fastjson2.schema.JSONSchema.assertValidate(JSONSchema.java:814)

Contributor guide

Open the contributing guide

Research direction

Start at JSONSchema.java line 814, where the reported validation exception is raised. Run the provided Java reproduction with maximum 10 and value 11, then correct the maximum message so it reports the expected <= 10 relation and confirms the actual value 11.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.