Skip to content
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

broken curl commands for formData with collectionFormat=multi #3838

Closed
xanoinc opened this issue Oct 28, 2017 · 5 comments · Fixed by #5999
Closed

broken curl commands for formData with collectionFormat=multi #3838

xanoinc opened this issue Oct 28, 2017 · 5 comments · Fixed by #5999

Comments

@xanoinc
Copy link

xanoinc commented Oct 28, 2017

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"
                    }
                }
@webron
Copy link
Contributor

webron commented Oct 30, 2017

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

@xanoinc
Copy link
Author

xanoinc commented Oct 30, 2017

my apologies @webron

This is for swagger 2.0

@xanoinc xanoinc changed the title broken curl commands for formData with collectionFormat=multi swagger 2 - broken curl commands for formData with collectionFormat=multi Oct 30, 2017
@webron
Copy link
Contributor

webron commented Oct 30, 2017

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

@xanoinc
Copy link
Author

xanoinc commented Oct 30, 2017

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

@xanoinc xanoinc changed the title swagger 2 - broken curl commands for formData with collectionFormat=multi broken curl commands for formData with collectionFormat=multi Oct 30, 2017
@paul-lysak
Copy link

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.

@shockey shockey removed the type: bug label Jan 15, 2019
@tim-lai tim-lai self-assigned this Apr 21, 2020
tim-lai added a commit to tim-lai/swagger-ui that referenced this issue May 11, 2020
ft: utils.createObjWithHashedKeys
ft: curlify.extractKey
test: curlify with array representation
tim-lai added a commit that referenced this issue May 13, 2020
ft: utils.createObjWithHashedKeys
ft: curlify.extractKey
test: curlify with array representation
Pentusha added a commit to Pentusha/swagger-ui that referenced this issue May 27, 2020
* 'master' of github.com:swagger-api/swagger-ui: (37 commits)
  release: v3.25.4
  chore(package): bump swagger-client to 3.10.4 version
  fix: entries as property name (swagger-api#6025)
  release: v3.25.3
  housekeeping: update release-it config (swagger-api#6009)
  housekeeping: bump swagger-client version with package-lock (swagger-api#6008)
  housekeeping: update dev-e2e-cypress-open script name (swagger-api#6005)
  fix: jsonSchemaComponent file/files (swagger-api#5997) (swagger-api#6000)
  fix: curl array support within multipart/form-data (swagger-api#3838) (swagger-api#5999)
  release: v3.25.2
  bug: remove clearValidation from onTryoutClick (swagger-api#5955)
  ft: JsonSchema components are now ImmutableJS compliant (swagger-api#5952)
  release: v3.25.1
  housekeeping: revert @release-it/conventional-changelog version (swagger-api#5976)
  housekeeping: add missing conventional-changelog devDeps (swagger-api#5975)
  docs: update plugin api component for failSilently (swagger-api#5953)
  housekeeping: `npm audit fix` (swagger-api#5948)
  housekeeping: prevent log warning for missing getComponent in production
  fix(docker-image): send relative HTTP 301s from within container (swagger-api#5409)
  support for supportedSubmitMethods property in react component (swagger-api#5376)
  ...
mattyb678 pushed a commit to mattyb678/swagger-ui that referenced this issue Jun 24, 2020
…swagger-api#5999)

ft: utils.createObjWithHashedKeys
ft: curlify.extractKey
test: curlify with array representation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants