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

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