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

Json validation with "multipleOf": 0.1 fails when it shouldn't #1897

Closed
dimpon opened this issue Mar 8, 2022 · 3 comments
Closed

Json validation with "multipleOf": 0.1 fails when it shouldn't #1897

dimpon opened this issue Mar 8, 2022 · 3 comments
Labels

Comments

@dimpon
Copy link

dimpon commented Mar 8, 2022

Describe the bug

json validation "multipleOf": 0.1 doesn't work with some values.

Expected behavior

with constraint "multipleOf": 0.1 value 100.1 must be considered as valid.

Steps to reproduce the issue

  1. run the project https://github.com/dimpon/jsonforms-angular-seed
  2. enter 100.1 - validation is failed
  3. enter 45.5, 41.1 - all is fine

Screenshots

image

In which browser are you experiencing the issue?

Google Chrome Version 98.0.4758.102 (Official Build) (64-bit)

Framework

Angular

RendererSet

Material

Additional context

No response

@eneufeld
Copy link
Member

eneufeld commented Mar 8, 2022

Thank you for the report and the great reproducer.
I tracked the error down to ajv, there is even a discussion about it:
ajv-validator/ajv#84 and ajv-validator/ajv#652

So the recommendation is to either use an additional option:
https://github.com/ajv-validator/ajv/blob/master/docs/options.md#multipleofprecision
or a regex pattern: ajv-validator/ajv#84 (comment)

Does this help?

@sdirix
Copy link
Member

sdirix commented Mar 9, 2022

This was also already reported before: #1880.

I'll add a task for the website to add this to the FAQ.

@sdirix
Copy link
Member

sdirix commented Mar 25, 2022

I'll close this for now as no change to JSON Forms is needed. Feel free to reopen if you disagree.

@sdirix sdirix closed this as completed Mar 25, 2022
@sdirix sdirix added the wontfix label Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants