hapijs / joi

The most powerful data validation library for JS
Other
20.95k stars 1.51k forks source link

Joi.number() doesn't allow float #3045

Closed khuongtp closed 4 months ago

khuongtp commented 4 months ago

Runtime

node.js

Runtime version

20.13.1

Module version

17.12.3

Last module version without issue

No response

Used with

No response

Any other relevant information

No response

What are you trying to achieve or the steps to reproduce?

const testSchema = {
  test: Joi.number()
};

await testSchema.validateAsync({test: 1.9});

What was the result you got?

test must be an integer

What result did you expect?

No errors at all

Marsup commented 4 months ago

Can't reproduce, that's obviously part of the basic unit tests on that type, so it's in your setup.

khuongtp commented 4 months ago

I apologize for the confusion. It turns out the issue wasn't with Joi; I misread the error message from Strapi CMS. Thanks for your quick reply. Have a great day!