-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Request body with multiple identical MIME types? #2145
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
Comments
@mirw, in the 3GPP 5G APIs, the approach is to have the first body part of the multipart/related containing an application/json body part, which includes a JSON document indicating what goes inside the different binary body parts. This "link" is done, as you indicate, with the Content-ID of each binary body part, which is required. |
@jdegre, thanks - makes sense! So this is just documented in human-readable docs, rather than in a machine-readable way in the OpenAPI specification? |
@mirw, trying to reuse your example, it would be somethign like this: paths:
/multiple-identical-mime-types:
post:
requestBody:
required: true
content:
multipart/related:
schema:
type: object
properties:
# Root body part (JSON)
jsonData:
type: object
properties:
binary1ContentId:
type: string
binary2ContentId:
type: string
# End of root body part
binary1:
type: string
format: binary
binary2:
type: string
format: binary
encoding:
jsonData:
contentType: application/json
binary1:
contentType: application/octet-stream
headers:
Content-Id:
schema:
type: string
binary2:
contentType: application/octet-stream
headers:
Content-Id:
schema:
type: string
responses:
200:
description: OK So, yes, there is an attempt to fully describe it in OpenAPI. The first body part (or the "root" of the multipart/related body, as RFC 2387 calls it) contains the JSON object, with "pointers" to the ContentId's of the other body parts. |
Thanks! Agreed. I was observing that there's no annotation in OpenAPI that says that the |
The OpenAPI definition at the bottom describes a single POST request whose body contains 2
multipart/related
sections, each with the same MIME type (application/octet-stream
).It seems to be legal according to the specification (please point out why if not!)
If a server receives this request, how does it identify which of the
multipart/related
sections inbinary1
and which isbinary2
?Does it use ordering? (The first section is interpreted to be
binary1
and the second section is interpreted to bebinary2
.)Does it use some section header information? RFC 2387, which defines
multipart/related
mentions theContent-ID
header but doesn't specify exactly how it's used.Please can someone clarify? ...and unless I'm misreading the OpenAPI spec, should we clarify it there too?
Thanks!
#303 resulted in multipart/mixed being added, but this did not address this question.
BTW, this structure is used reasonably frequently within the 3GPP 5G specs, e.g. TS 29.518.
The text was updated successfully, but these errors were encountered: