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

Error "Must be a multiple of 0.01" for Value=2000000.13 #3917

Closed
4 tasks done
Alicezhang821 opened this issue Oct 23, 2023 · 4 comments
Closed
4 tasks done

Error "Must be a multiple of 0.01" for Value=2000000.13 #3917

Alicezhang821 opened this issue Oct 23, 2023 · 4 comments
Labels
ajv playground possibly close To confirm if this issue can be closed validation

Comments

@Alicezhang821
Copy link

Alicezhang821 commented Oct 23, 2023

Prerequisites

What theme are you using?

Version

5.x

Current Behavior

Hello,
I used the playground https://rjsf-team.github.io/react-jsonschema-form/ to create a number field, but it failed with validation for some values like '2000000.13', error message says 'Must be a multiple of 0.01'

JSONSchema
{ "type": "object", "title": "Number fields & widgets", "properties": { "number": { "title": "Number", "type": "number", "multipleOf": 0.01 } } }
UISchema
{}
Some other values failed the validation as well, for example
39999999.12
1234599.12

Thanks in advance.

Expected Behavior

The field should accept number like '2000000.13'

Steps To Reproduce

No response

Environment

- OS:
- Node:
- npm:

Anything else?

No response

@Alicezhang821 Alicezhang821 added bug needs triage Initial label given, to be assigned correct labels and assigned labels Oct 23, 2023
@linde12
Copy link

linde12 commented Oct 24, 2023

ajv6 or 8? spontaneous thought is floating point error or side effect of the multipleOfPrecision setting but did not look deeper

@YuJianghao
Copy link

ajv6 or 8? spontaneous thought is floating point error or side effect of the multipleOfPrecision setting but did not look deeper

I tried: ajv8 with multipleOfPrecision: 4 can fix it. ajv doc for multipleOfPrecision

@heath-freenome
Copy link
Member

heath-freenome commented Oct 27, 2023

@Alicezhang821 Given the comment above, it seems to be an AJV bug. If you are experiencing this in your application, you can set the precision for the validator-ajv6 or validator-ajv8 using the ajvoptionsoverrides capability for your validator. If it's only a playground issue, then we'd like close it. Thanks!

@heath-freenome heath-freenome added playground ajv possibly close To confirm if this issue can be closed validation and removed bug needs triage Initial label given, to be assigned correct labels and assigned labels Oct 27, 2023
@Alicezhang821
Copy link
Author

Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ajv playground possibly close To confirm if this issue can be closed validation
Projects
None yet
Development

No branches or pull requests

4 participants