Open LvckyAPI opened 2 weeks ago
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.
True
False
Validator says:
422 Unprocessable Entity { "message": "The all field must be true or false.", "errors": { "all": [ "The all field must be true or false." ] } }
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.
It should pass validation rules
If a boolean is required, send a boolean
Context
Related to: https://github.com/dedoc/scramble/issues/615
In Laravel I try to validate boolean:
The generated docs have correctly seen it needs boolean. At the sample request I can choose
True
orFalse
.Current Behavior
Validator says:
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