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

补充文档验证器注解@Integer、@Decimal和@Number数据类型的说明 #705

Open
wants to merge 1 commit into
base: 2.1
Choose a base branch
from

Conversation

Eno-CN
Copy link
Member

@Eno-CN Eno-CN commented Jun 29, 2024

  • 补充文档验证器注解 @Integer@Decimal@Number 数据类型的说明
  • 修正文档验证器注解 @Number 下的示例

>
> 例如,类似 `5.1` 、 `'5.1'` 、 `'5.0'` 均属于小数
>
> 特殊的,类似 `5.0` 这种**小数部分为0的 `float` 值**不属于小数
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5.0 算小数吧

Copy link
Member Author

@Eno-CN Eno-CN Jul 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5.0 算小数吧

我记得应该是5.0的float值转string后直接就丢失小数点了,然后第二个条件不满足。在整数那里恰好也能过,所以它满足上面提到的整数,而不满足小数的条件。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得这算bug了,应该修复下代码

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

整数和小数这两个的判断都有涉及这个问题,我觉得如果能严格判断数据类型就更好了,比如再给个严格模式的选项。

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

Successfully merging this pull request may close these issues.

None yet

2 participants