Skip to content

Help request: Multipart form request with multiple files #2479

@yanavasileva

Description

@yanavasileva

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

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