Skip to content

broken curl commands for formData with collectionFormat=multi #3838

Closed

Description

@xanoinc

engine: Swagger 2.0
swagger-ui - 3.4.1

It looks like collectionFormat=multi is being ignored and it is trying to do csv instead.

Here is a screenshot - https://gmkr.io/s/59f4c80a5e287dbf0e76dc1e/0

Attached is the full swagger config.
swagger-multipart.zip

Here is the specific block.

                {
                    "in": "formData",
                    "name": "email[]",
                    "description": "The list of emails.",
                    "type": "array",
                    "collectionFormat": "multi",
                    "items": {
                        "type": "string"
                    }
                }

Activity

  1. webron commented on Oct 30, 2017

    @webron
    Contributor

    You ignored the issue template and so... didn't provide any details on which version you use.

  2. xanoinc commented on Oct 30, 2017

    @xanoinc
    Author

    my apologies @webron

    This is for swagger 2.0

  3. changed the title [-]broken curl commands for formData with collectionFormat=multi[/-] [+]swagger 2 - broken curl commands for formData with collectionFormat=multi[/+] on Oct 30, 2017
  4. webron commented on Oct 30, 2017

    @webron
    Contributor

    Not referring to the spec version but swagger-ui's version...

  5. xanoinc commented on Oct 30, 2017

    @xanoinc
    Author

    @webron this the latest version from master - which I believe is 3.4.1

  6. changed the title [-]swagger 2 - broken curl commands for formData with collectionFormat=multi[/-] [+]broken curl commands for formData with collectionFormat=multi[/+] on Oct 30, 2017
  7. paul-lysak commented on Jan 10, 2019

    @paul-lysak

    Observing same behavior with Swagger UI 3.20.3 taken from WebJars (https://mvnrepository.com/artifact/org.webjars/swagger-ui/3.20.3)
    This is the parameter we have:

          {
            "in": "formData",
            "name": "param1",
            "type": "array",
            "items": {
              "type": "string"
            },
            "collectionFormat": "multi"
          }
    

    When specifying dddd and eeee as values for the parameter in SwaggerUI we're getting such fragment in curl command: -F "param1="dddd","eeeee"".
    The actual HTTP request made by SwaggerUI also contains comma-separated values in a single parameter rather than multiple parameters with same name.
    This request also wraps each value in double quotes - so that acutal value of param field in reuqest is "dddd","eeee".

    There's similar bug for OpenAPI 3.0 specs: #5106 . The only difference is that for OpenAPI values aren't wrapped in double quotes -
    i.e. param1 value becomes dddd,eeee.

  8. self-assigned this
    on Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions