Skip to content

Allow BindStyledParameterWithOptions to fill maps - #72

Merged
mromaszewicz merged 1 commit into
oapi-codegen:mainfrom
JoZie:fix/map
Oct 30, 2025
Merged

Allow BindStyledParameterWithOptions to fill maps#72
mromaszewicz merged 1 commit into
oapi-codegen:mainfrom
JoZie:fix/map

Conversation

@JoZie

Copy link
Copy Markdown
Contributor

In our API we have something like:

/v2/store/{key}:
put:
summary: Store with Metadataparameters:
- name: keyin: pathrequired: trueexplode: falsestyle: simpleschema:
type: string
- name: X-Metadatain: headerrequired: falseexplode: falseschema:
type: objectadditionalProperties:
type: string

If the X-Metadata header is defined with e.g. "foo,bar" I always get the error:Invalid format for parameter X-Metadata: error binding string parameter: can not bind to destination of type: map.

The issue is that the X-Metadata type is a map[string]string which is not handled by BindStyledParameterWithOptions.

I extended the function to use the same code path for reflect.Map as for reflect.Struct

@JoZie
JoZie requested a review from a team as a code ownerJune 10, 2025 12:57
@mromaszewicz
mromaszewicz merged commit 179c5e9 into oapi-codegen:mainOct 30, 2025
@jamietannajamietanna mentioned this pull request Oct 30, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@JoZie@mromaszewicz