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

Allow BindStyledParameterWithOptions to fill maps by JoZie · Pull Request #72 · oapi-codegen/runtime · GitHub

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 commented Jun 10, 2025

Copy link
Copy Markdown
Contributor

In our API we have something like:

  /v2/store/{key}:
    put:
      summary: Store with Metadata
      parameters:
        - name: key
          in: path
          required: true
          explode: false
          style: simple
          schema:
            type: string
        - name: X-Metadata
          in: header
          required: false
          explode: false
          schema:
            type: object
            additionalProperties:
              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 requested a review from a team as a code owner June 10, 2025 12:57
mromaszewicz merged commit 179c5e9 into oapi-codegen:main Oct 30, 2025
jamietanna mentioned this pull request Oct 30, 2025
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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL