Skip to content

[typescript] fix: explode: true should yield appended query params#19519

Merged
macjohnny merged 2 commits intoOpenAPITools:masterfrom
joscha:joscha/fix-exploded-query-params
Sep 4, 2024
Merged

[typescript] fix: explode: true should yield appended query params#19519
macjohnny merged 2 commits intoOpenAPITools:masterfrom
joscha:joscha/fix-exploded-query-params

Conversation

@joscha
Copy link
Copy Markdown
Contributor

@joscha joscha commented Sep 3, 2024

Currently, when a query param is defined as:

        - name: context
          in: query
          required: true
          explode: true
          schema:
            type: array
            items:
              type: string

for a context of ['a','b','c'] it serializes the query incorrectly as:
?context=a,b,c
however, due to explode: true it should be:
?context=a&context=b&context=c.

The change in this PR makes sure that any query params with explode: true are serialized correctly.

It also fixes the exploded serialization for object types.

See example table here: https://swagger.io/docs/specification/serialization/#Query%20Parameters

PR checklist

Copy link
Copy Markdown
Member

@macjohnny macjohnny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your contribution!

@bodograumann
Copy link
Copy Markdown
Contributor

For anyone looking here, I just want to mention that this broke enum serialization in query parameter, but it is now fixed on master: #20210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants