OpenAPITools / OpenAPITools/openapi-generator
[BUG] Ruby query param serialization defaults
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
The query param serialization default properties are inconsistent with the Open api spec. The explode parameter default should be true when the style is form.
openapi-generator version
6.2
OpenAPI declaration file content or url
A query parameter like this:
in: query
name: some_ids
style: form
schema:
type: array
items:
type: string
Generation Details
openapi-generator-cli generate -c /some/path -i /path-to-spec -g ruby -o /outputdir
Steps to reproduce
- Create a spec with an array parameter of type query.
- Generate the client.
- Hit the endpoint.
- Expected behavior is that the parameters are exploded (i.e. some_ids=1&some_ids=2)
- Actual behavior: they're csv format (you can make them exploded by including
explode: trueexplicitly) but this is supposed to be the default behavior.
The open api spec definition for explode.
When this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false.
See: https://swagger.io/specification/
Related issues/PRs
N/A
Suggest a fix
Not sure
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by generating a Ruby client from the YAML query-parameter declaration and trace how array parameters are serialized for the form style. Confirm the generated request uses repeated parameters such as some_ids=1&some_ids=2 without an explicit explode setting, and add regression coverage for that default behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, ruby
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100