Skip to content

Allow BindStyledParameterWithOptions to fill maps #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JoZie
Copy link

@JoZie JoZie commented Jun 10, 2025

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 JoZie requested a review from a team as a code owner June 10, 2025 12:57
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.

1 participant