rjsf-material-ui icon indicating copy to clipboard operation
rjsf-material-ui copied to clipboard

minimum, maximum and multipleOf not working as expected

Open marianobianchi opened this issue 5 years ago • 0 comments

When using the playground in https://rjsf-team.github.io/react-jsonschema-form/ I can make use of minimum, maximum and multipleOf and they are working correctly. To reproduce, go to "numbers" example (click on button Numbers at the top of the page) and add to the "number" field in the JSON schema these properties:

"minimum": 0,
"maximum": 100,
"multipleOf": 0.5

You can see it in action in the next gif

example_number_working

Here I show how the step is working (going up and down 0.5 in each click) and the minimum limit is working too (I kept clicking down but the number remained in 0).

When I test this in rjsf-material-ui playground, this is not working at all. I don't get the limit nor the step working as expected. I didn't have the time to check the code to see what can be wrong, but I wanted to add the issue at least to let this open until someone can fix it.

To reproduce this issue, you should add this in the JSON schema for the "number" field:

"minimum": 0,
"maximum": 100,
"multipleOf": 0.5

and this in the uiSchema:

"number": {
  "ui:widget": "updown"
}

With these changes, it is working like this:

example_number_not_working

But it seems that the "multipleOf" is being used to validate, because if I write a number that is not a multiple of 0.5, I get this:

imagen

marianobianchi avatar Dec 27 '19 14:12 marianobianchi