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

Help request: Multipart form request with multiple files #2479

Closed
yanavasileva opened this issue Feb 23, 2021 · 2 comments
Closed

Help request: Multipart form request with multiple files #2479

yanavasileva opened this issue Feb 23, 2021 · 2 comments

Comments

@yanavasileva
Copy link

yanavasileva commented Feb 23, 2021

Hello,

We need to document multipart form request with OAS 3.0. The tricky part is that among string form data, there are also unspecified number of files (1+), and those form keys doesn't have static names.

Request example:

--28319d96a8c54b529aa9159ad75edef9
Content-Disposition: form-data; name="deployment-name"

My Deployment1
--28319d96a8c54b529aa9159ad75edef9
Content-Disposition: form-data; name="enable-duplicate-filtering"

false
--28319d96a8c54b529aa9159ad75edef9
Content-Disposition: form-data; name="deployment-source"

process application
--28319d96a8c54b529aa9159ad75edef9
Content-Disposition: form-data; name="process1"; filename="process1.bpmn"

<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions ...>
  <!-- BPMN 2.0 XML omitted -->
</bpmn2:definitions>
--28319d96a8c54b529aa9159ad75edef9--
Content-Disposition: form-data; name="process2"; filename="process2.bpmn"

<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions ...>
  <!-- BPMN 2.0 XML omitted -->
</bpmn2:definitions>
--28319d96a8c54b529aa9159ad75edef9--

or curl code:

curl --location --request POST 'http://{{baseUrl}}/deployment/create' \
--form 'deployment-name="My Deployment1"' \
--form 'enable-duplicate-filtering="false"' \
--form 'deployment-source="process application"' \
--form 'process1=@"/path/to/process1.bpmn"' \
--form 'process2=@"/path/to/process2.bpmn"'

As you can see, the passed files could have an arbitrary form keys, they only need to be unique.

From what I read in the specification and closed issues, I expect that this should be possible. However, I would like to verify with you as it seems that none of the client generators that I tried supports it.

Here is an example of definition:

  /deployment/create:
    post:
      operationId: createDeployment
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              additionalProperties:
                type: string
                format: binary
              properties:
                deployment-name:
                  type: string
                enable-duplicate-filtering:
                  type: string
                deployment-source:
                  type: string

Do you have any recommendations? Any input will be highly appreciated.

Best regards,
Yana

@hkosova
Copy link
Contributor

hkosova commented Nov 1, 2021

@yanavasileva your API definition is correct and matches the request examples.

none of the client generators that I tried supports it.

It's a tooling issue. Please open an issue with the code generator that you use.

@handrews
Copy link
Member

handrews commented Mar 1, 2023

Since it's been over a year and the last comment was that this was a tooling issue, I'm going to go ahead and close this.

@handrews handrews closed this as completed Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants