interagent / interagent/committee

Query parameters: Conversion of array items does not work if parameter name ends with "[]"

Open
#369 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
955
Forks
145
Avg merge
5d 4h
Merged PRs (30d)
6

Description

This is related to https://github.com/interagent/committee/issues/253

Given you have a parameter definition like this, where the name ends with a "[]", because that is a standard you've agreed on.

parameters:
  - name: ids[]
    description: IDs of the things to get
    in: query
    schema:
      type: array
      items:
        type: integer

Expected behavior:
For a request like GET /things?ids[]=1&ids=[]=2, I would expect committee to convert the array items to integers as described in the API description.

Current behavior:
Array items do not get converted to integers, but remain strings.

I guess this is mostly due to Rack's default handling of "xx[]" parameters, as it handles those as an "xx" array by default, so this might be tricky.

Do you plan to support this? If so I would be happy to help.

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

Start by reproducing the documented GET request with a parameter named ids[] and compare the parsed values with the schema's integer item type. Trace how Rack's default handling of bracketed query parameters reaches Committee's query-parameter conversion; done means ids[] array items are converted to integers as described by the API schema.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.