Description
openedon Sep 26, 2023
Description
When an OpenAPI description defines endpoints with > 1 content types for the body content, only the first application/json
ish entry is handled by the SDK.
Repro
Given a minimal OpenAPI such as:
openapi: 3.0.0
info:
title: Test
version: 1.0.0
description: something
paths:
/api:
post:
requestBody:
content:
"*/*":
schema:
type: number
"application/create.extended+json":
schema:
type: array
items:
type: integer
"application/json":
schema:
type: array
items:
type: number
"application/xml":
schema:
type: string
"text/plain":
schema:
type: array
items:
type: string
responses:
"200":
description: "something"
content:
application/json: {}
We can observe that the only generated PostRequestInformation
contains this line (in Java but similar in other languages):
requestInfo.setContentFromScalarCollection(requestAdapter, "application/create.extended+json", body.toArray(new Integer[0]));
Questions
Is it a deliberate choice? I'm failing at finding references in the docs.
Would it be possible to generate multiple toPostRequestInformation
methods to cover all of the Content-Type
s handled by the server? Cannot find another issue referring to this limitation.
Do you have an idiomatic way to work around the current behavior other than fixing the RequestInformation
object before sending it through the adapter
?
Should the(current) implementation give precedence to application/json
and, only if not found, apply cleaning?
Thoughts?
Metadata
Assignees
Type
Projects
Status
Done ✔️