Number rule not valid

#1

Hi there. I am trying to create rules for a request using validator, however when i add the ‘number’ rule which is available on indicative documentation I get this error:

[
    {
        "field": "cost",
        "validation": "ENGINE_EXCEPTION",
        "message": "number is not defined as a validation"
    }
]

here is my code:

  const rules = {
  manufacturer: 'required|integer',
  cost: 'required|number',
  items: 'required|array'
}
const validation = await Validator.validate(request.all(), rules)

Using integer works however I want to allow for decimals in the cost property.
Thanks in advance

0 Likes

#2

This looks like a bug. It’s stated that all rules from indicative can be used
You may want to create an issue here

0 Likes

#3

Alright I will post it there, thanks.

0 Likes