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

Parameter's value set to false is recognized as nil #771

Open
damuz91 opened this issue Aug 29, 2022 · 2 comments
Open

Parameter's value set to false is recognized as nil #771

damuz91 opened this issue Aug 29, 2022 · 2 comments

Comments

@damuz91
Copy link

damuz91 commented Aug 29, 2022

Today i updated the version of the gem from 0.5.19 to latest 0.8.1 and found out that Requests that send a value as false are failing due validators recognizing them as nil.

#749 Maybe related to this.

The payload i'm sending contains:

{
   my_param: false
}

The validators:

param :my_param, [true,false], required: false

The message returned:

{
    "success": "false",
    "error": "Invalid parameter 'my_param' value nil: Must be one of: <code>true</code>, <code>false</code>."
}

But this is not happening back in 0.5.19

🙏

@waseem-ghafoor
Copy link

waseem-ghafoor commented Sep 19, 2022

It is happening the same to me too. For version 0.8.2

@mathieujobin
Copy link
Collaborator

you can try two things

  1. set this option to revert previous behavior
    Apipie.configuration.ignore_allow_blank_false = true
  2. use :boolean validator instead of the [true, false] value array...

param :my_param, :boolean, required: false

please let me know if it fixes your problem.

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

3 participants