Apipie/apipie-rails

Params are not parsed correctly

Closed this issue · 2 comments

I have a Rails app running on version 4 with apipie v0.4.0 which I'm currently upgrading to Rails 5.2.0 and the latest apipie version.
Before upgrade, everything was working smoothly but now seems like apipie is not dealing with parameter correctly.

I have the following validation:

param :workspace_id, Integer, required: false, desc: 'worspace selection, (default) is the personal workspace'

and the following RSpec test:

get :index, params: { workspace_id: @workspace.id, resources: [resource], as: :json }, as: :json

I'm 100% sure that @workspace.id returns an Integer but the test fails with

Validator of Parameters - Invalid parameter 'workspace_id' value \\\"1\\\": Must be a Integer

Also might be on Rails side, I don't know, but I have other apps running on Rails 5 and they all are working fine so I assume the problem is on apipie side...maybe the validations are running too soon, before Rails jump in and parse params?

Any ideas?

@luizkowalski I faced the same problem and solve by changing from Integer to :number.
Ref: #248

I think @jkatagi got the right answer. Closing the issue. Feel free to reopen in case you thing here is more to be done here.