Ask a Question

OpenAPI not encoding multipart/mixed correctly

tim-hilt
New Member

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.

0 REPLIES 0
cancel
Showing results for 
Search instead for 
Did you mean: