ruby-grape / ruby-grape/grape-swagger

Cannot post Array params

Open
#626 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
1.1k
Forks
479
Avg merge
2d 14h
Merged PRs (30d)
6

Description

params do
  ...
  optional :user_profiles, type: Array, default: [] do
    requires :value, type: String, desc: "Value of the user profile"
  end
end

Using the above gives me curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'user_profiles[value]=1' 'http://localhost:3000/api/v1/accounts/3/users', and it rejects with user_profiles invalid.

Can someone tell me what am I doing wrong here? Thx!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is identified. Start by reproducing the documented POST with the shown Grape params and compare the generated form encoding with the request Grape accepts; done means array parameters are documented with an accepted request format and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.