elements
elements copied to clipboard
Boolean values are not sent as boolean while send request
Context
Related to: https://github.com/dedoc/scramble/issues/615
In Laravel I try to validate boolean:
public function index(Request $request)
{
$request->validate([
'page' => 'sometimes|integer|min:1',
'all' => 'sometimes|boolean'
]);
}
The generated docs have correctly seen it needs boolean. At the sample request I can choose True or False.
Current Behavior
Validator says:
422 Unprocessable Entity
{
"message": "The all field must be true or false.",
"errors": {
"all": [
"The all field must be true or false."
]
}
}
Stoplight Elements sends "true" and "false" strings as booleans, and Laravel API throws an error.
Expected Behavior
It should pass validation rules
Possible Solution(s)
If a boolean is required, send a boolean
ping! :) @SB-ChetanKorde
boolean
The field under validation must be able to be cast as a boolean. Accepted input are true, false, 1, 0, "1", and "0".
You may use the strict parameter to only consider the field valid if its value is true or false: