0

I have a parameter defined as such:

param :purchased, [true, false]

This leads to the following error:

Invalid parameter 'purchased' value true: Must be one of: true, false.

I have also tried:

param :purchased, [true, false, 'true', 'false']

but it didn't change anything.

Unfortunately also I cannot cover this in the tests as there the sent boolean is always cast into a String. Then the error looks like this:

Invalid parameter 'purchased' value "true": Must be one of: true, false.

Can anybody help here? Also I would be happy to just disable the validation of Apiepie as I am only interested in the documentation part.

Holger Just
  • 52,918
  • 14
  • 115
  • 123
migo
  • 33
  • 5
  • Can you specifiy in which context `param :purchased, [true, false]` was defined – OuttaSpaceTime Oct 11 '22 at 11:18
  • What do you mean with context exactly? This is the entire apipie block. Does that help ```api :POST, '/memberships/', '...' param :course_id, String, :desc => "...", :required => true param :affiliate_id, :number, :desc => "The ID of the affiliate", :required => true param :purchased, [true, false, 'true', 'false'], :desc => "..." returns :code => 201 do property :membership, Membership, :desc => "When resource created." end returns :code => 200 do property :membership, Membership, :desc => "When resource existed." end ``` – migo Oct 13 '22 at 07:45
  • actually looking at my original post I see that due to formatting here, some info was strupped out the actual message says: "Invalid parameter 'purchased' value true: Must be one of: true, false." – migo Oct 13 '22 at 07:49
  • so is "param" supposed to be hash of key value pairs? – OuttaSpaceTime Oct 13 '22 at 15:05

0 Answers0