You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+64Lines changed: 64 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -153,6 +153,70 @@ func NewStringID(v string) ID
153
153
func NewIntID(v int) ID
154
154
```
155
155
156
+
## Multiple Response Content Types
157
+
158
+
For responses with multiple possible content types, a parameter is automatically added to represent the HTTP Accept header.
159
+
If desired, the generated server can use this parameter to pick a response format, and the generated client can use this parameter to set the Accept header.
160
+
Existing parameters remain untouched, and if a parameter is explicitly defined for the Accept header, no automatic parameter is generated.
161
+
162
+
Given the following OpenAPI spec:
163
+
164
+
```yaml
165
+
openapi: 3.0.3
166
+
paths:
167
+
/multipleContentTypes:
168
+
get:
169
+
operationId: multipleContentTypes
170
+
responses:
171
+
"200":
172
+
description: "OK"
173
+
content:
174
+
application/octet-stream:
175
+
schema:
176
+
type: string
177
+
format: binary
178
+
application/json:
179
+
schema:
180
+
type: object
181
+
properties:
182
+
data:
183
+
type: string
184
+
required:
185
+
- "data"
186
+
```
187
+
188
+
The server can handle the Accept header like this:
0 commit comments