Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LvckyAPI opened this issue Nov 11, 2024 · 0 comments
Open

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

LvckyAPI opened this issue Nov 11, 2024 · 0 comments

Comments

@LvckyAPI
Copy link

LvckyAPI commented Nov 11, 2024

Context

Related to: dedoc/scramble#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

@LvckyAPI LvckyAPI changed the title Boolean values are not sent as boolean Boolean values are not sent as boolean while send resquest Nov 11, 2024
@LvckyAPI LvckyAPI changed the title Boolean values are not sent as boolean while send resquest Boolean values are not sent as boolean while send request Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant