tim-hilt
3 years agoNew 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:
- file is not encoded properly. Chrome DevTools show it to be of type object File instead of binary
- 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.