Skip to content

Commit f7f869b

Browse files
committed
Add a more complex header example
1 parent dbf07e1 commit f7f869b

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

src/oas.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2486,7 +2486,7 @@ Using `content` with a `text/plain` media type is RECOMMENDED for headers where
24862486
| ---- | :----: | ---- |
24872487
| <a name="header-content"></a>content | Map[`string`, [Media Type Object](#media-type-object)] | A map containing the representations for the header. The key is the media type and the value describes it. The map MUST only contain one entry. |
24882488

2489-
##### Header Object Example
2489+
##### Header Object Examples
24902490

24912491
A simple header of type `integer`:
24922492

@@ -2513,6 +2513,38 @@ ETag:
25132513
pattern: ^"
25142514
```
25152515

2516+
A `Link` header that, if present, must include links with the standard relation types `self`, `first`, `prev`, `next`, and `last`, as might be used on a paginated collection:
2517+
2518+
```yaml
2519+
Link:
2520+
schema:
2521+
type: array
2522+
uniqueItems: true
2523+
minItems: 5
2524+
maxItems: 5
2525+
items:
2526+
type: string
2527+
anyOf:
2528+
- pattern: rel="?first"?
2529+
- pattern: rel="?prev"?
2530+
- pattern: rel="?self"?
2531+
- pattern: rel="?next"?
2532+
- pattern: rel="?last"?
2533+
style: simple
2534+
examples:
2535+
CollectionLinks:
2536+
dataValue:
2537+
- https://example.com/foos?page=1; rel=first
2538+
- https://example.com/foos?page=4; rel=prev
2539+
- https://example.com/foos?page=5; rel=self
2540+
- https://example.com/foos?page=6; rel=next
2541+
- https://example.com/foos?page=10; rel=last
2542+
serializedValue: https://example.com/foos?page=1; rel=first, https://example.com/foos?page=4; rel=prev, https://example.com/foos?page=5; rel=self, https://example.com/foos?page=6; rel=next, https://example.com/foos?page=10; rel=last
2543+
```
2544+
2545+
Note that the `items`, `uniqueItems: true`, and `anyOf` combination allows the links to appear in any order.
2546+
If a fixed order is desired, then `prefixItems` could be used and `uniqueItems` would not be necessary.
2547+
25162548
#### Tag Object
25172549

25182550
Adds metadata to a single tag that is used by the [Operation Object](#operation-object).

0 commit comments

Comments
 (0)