I have the following JavaScript code to test out the Hapi/Joi validation functions:
var Joi = require('joi');
var schema = { free: Joi.Types.Number().float() };
var value = { free: 3.3333 };
var err = Joi.validate(value, schema);
//err is set if value fails to validate against the schema
if (err) throw err;
The validation throws the error:
Error: the value of free must be an integer
I would like to know what I am doing wrong. I am using the current versions of Hapi and Joi.