Skip to content

Bug report: omitted array parameters with array_use_braces: true #952

Open
@olivier-thatch

Description

@olivier-thatch

When array_use_braces is set to true, array parameters are omitted when they are body parameters but don't explicitly specify documentation: { param_type: "body" }.

Example:

# with add_swagger_documentation(array_use_braces: true)

params do
  requires :param1, type: Array[String]
  requires :param2, type: Array[Integer], documentation: { param_type: "body" }
end
post :foo do
  { declared_params: declared(params)
end

The spec will look like:

"postFoo": {
  "required": ["param2"],
  "type": "object",
  "properties": {
    "param2": {
      "type": "array",
      "items": { "type": "integer", "format": "int32" }
    }
  }
}

It is particularly annoying if one wants to share some params between GET and POST/PUT/PATCH endpoints and rely on the implicit behavior to have the params be query params or body params as appropriate.

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