FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: parse un-exploded query param to map by alexdulin · Pull Request #101 · oapi-codegen/runtime · GitHub

fix: parse un-exploded query param to map - #101

Merged
mromaszewicz merged 1 commit into
oapi-codegen:mainfrom
alexdulin:fix-unexploded-map
Mar 2, 2026
Merged

fix: parse un-exploded query param to map#101
mromaszewicz merged 1 commit into
oapi-codegen:mainfrom
alexdulin:fix-unexploded-map

Conversation

alexdulin commented Mar 2, 2026
edited by mromaszewicz
Loading

Copy link
Copy Markdown
Contributor

This fixes an issue where query parameters that are objects with additional properties cannot be parsed into their values. For example, a query parameter like tags=foo,bar,bim,baz should end up becoming:

map[string]string{
  "foo": "bar",
  "bim": "baz",
}

This adheres to the spec for paramters of style=form and explode=false.

Improves the problem described in oapi-codegen/oapi-codegen#698 for empty schemas with additional properties, but doesn't address the issue of a non-empty schema with additional properties.

This fixes an issue where query parameters
that are objects with additional properties
cannot be parsed into their values. For example,
a query parameter like `tags=foo,bar,bim,baz` should
end up becoming:

```go
map[string]string{
  "foo": "bar",
  "bim": "baz",
}
```

This adheres to the [spec](https://swagger.io/docs/specification/v3_0/serialization/#query-parameters)
for paramters of style=form and explode=false.

Fixes: oapi-codegen/oapi-codegen#698

Signed-off-by: Alex Dulin <alex@morningconsult.com>
alexdulin requested a review from a team as a code owner March 2, 2026 17:49

Copy link
Copy Markdown
Member

This change is ok, but it doesn't quite fix oapi-codegen/oapi-codegen#698, because in that case, you've got a struct with a map for additional properties, and a custom JSON unmarshaler which knows how to handle it. We'd need something along those lines for parameters as well. It will work in the case where you have an empty schema with only additional properties, since that's converted to a map.

mromaszewicz added the bug Something isn't working label Mar 2, 2026
mromaszewicz merged commit d4b9383 into oapi-codegen:main Mar 2, 2026
14 checks passed
alexdulin deleted the fix-unexploded-map branch March 2, 2026 21:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL