stoplightio / elements

Build beautiful, interactive API Docs with embeddable React or Web Components, powered by OpenAPI and Markdown.
https://stoplight.io/open-source/elements/
Apache License 2.0
1.82k stars 206 forks source link

Boolean values are not sent as boolean while send request #2732

Open LvckyAPI opened 2 weeks ago

LvckyAPI commented 2 weeks ago

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.

image

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