Skip to content

Commit 4fcdbdc

Browse files
committed
add info on multiple responses
1 parent 3595bac commit 4fcdbdc

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

api-playground/customization/managing-page-visibility.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Common use cases for `x-excluded` are:
3333

3434
Add the `x-hidden` or `x-excluded` extension under the HTTP method in your OpenAPI specification.
3535

36-
Here are examples of how to use each property in an OpenAPI schema document for an endpoint and a webhook path:
36+
Here are examples of how to use each property in an OpenAPI schema document for an endpoint and a webhook path.
3737

3838
```json {11, 19}
3939
"paths": {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: "Multiple responses"
3+
description: "Show response variations for the same endpoint"
4+
---
5+
6+
If your API returns different responses based on input parameters, user context, or other conditions of the request, you can document multiple response examples with the `examples` property.
7+
8+
This property can be added to any response and has the following schema.
9+
10+
```yaml
11+
responses:
12+
"200":
13+
description: Successful response
14+
content:
15+
application/json:
16+
schema:
17+
$ref: "#/components/schemas/YourResponseSchema"
18+
examples:
19+
us:
20+
summary: Response for United States
21+
value:
22+
countryCode: "US"
23+
currencyCode: "USD"
24+
taxRate: 0.0825
25+
gb:
26+
summary: Response for United Kingdom
27+
value:
28+
countryCode: "GB"
29+
currencyCode: "GBP"
30+
taxRate: 0.20
31+
```

0 commit comments

Comments
 (0)