Skip to content

Cannot use unexploded query parameter with additional properties flattened  #698

@alexdulin

Description

@alexdulin

The additional properties flattening introduced in this commit breaks query parameters that are unexploded. Take the following example parameter schema:

in: query
name: example
description: |
  Example parameter
explode: false
schema:
  type: object
  additionalProperties:
    type: string
  maxProperties: 10
  example:
    tracker_id: "12345"
    topic: television

When used in a request as ?example=tracker_id,12345,topic,television, the runtime code fails to bind it with the following error:

Invalid format for parameter example: multiple values for single value parameter 'example'

My guess is because it is no longer a struct with flattening, it fails to meet a successful case in the switch statement here. Adding in reflect.Map along with reflect.Struct should fix it I think, but I am not familiar enough with this codebase to be certain, nor that it wouldn't break things elsewhere.

With this bug, the only workaround is to completely disable additional properties flattening with:

compatibility:
  disable-flatten-additional-properties: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions