Forum Discussion

tim-hilt's avatar
tim-hilt
New Member
3 years ago

OpenAPI not encoding multipart/mixed correctly

This is how the relevant portion of my endpoint looks like:

 

"/global-types/import-coordinates":
post:
summary: Import coordinates
operationId: importCoordinates
requestBody:
content:
multipart/mixed:
schema:
type: object
properties:
file:
type: string
format: binary
attributes:
type: array
items:
type: string
identifier:
type: string
required:
- file
- attributes
- identifier
responses:
201:
$ref: 'model.yaml#/components/responses/created'
400:
$ref: 'model.yaml#/components/responses/badRequest

However, when I call the generated function from TypeScript:

  1. file is not encoded properly. Chrome DevTools show it to be of type object File instead of binary
  2. The request fails with exit code 415 Unsupported Media Type

I found this issue on OpenAPIs GitHub. It's very old, but still not closed. Might this be related to my issue?

 

This is my first post to this forum, so please tell me, if you need more information. Thank you for every incoming reply or effort to help me out with this.

  • loucast0159's avatar
    loucast0159
    Occasional Contributor

    Yes we have the same problem with multipart/mixed and multipart/form-data not being rendered correctly when it generates the cURL command.  We have a bug-fix request with Smartbear for over one month now and still no resolution.  And apparently the issue has been there for quite some time.  According to their documentation it should work.  This is really becoming a big issue for us now.  Not sure why taking them so long to fix this problem.