Skip to content

Commit 4e4a292

Browse files
authored
Merge pull request #4265 from char0n/char0n/add-header-into-working-with-examples
Editorial change: Include Header Object into 'Working With Examples' section
2 parents 8598f2f + f896bb7 commit 4e4a292

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/oas.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,19 +2211,19 @@ Tooling implementations MAY choose to validate compatibility automatically, and
22112211

22122212
##### Working with Examples
22132213

2214-
Example Objects can be used in both [Parameter Objects](#parameter-object) and [Media Type Objects](#media-type-object).
2215-
In both Objects, this is done through the `examples` (plural) field.
2216-
However, there are several other ways to provide examples: The `example` (singular) field that is mutually exclusive with `examples` in both Objects, and two keywords (the deprecated singular `example` and the current plural `examples`, which takes an array of examples) in the [Schema Object](#schema-object) that appears in the `schema` field of both Objects.
2214+
Example Objects can be used in [Parameter Objects](#parameter-object), [Header Objects](#header-object), and [Media Type Objects](#media-type-object).
2215+
In all three Objects, this is done through the `examples` (plural) field.
2216+
However, there are several other ways to provide examples: The `example` (singular) field that is mutually exclusive with `examples` in all three Objects, and two keywords (the deprecated singular `example` and the current plural `examples`, which takes an array of examples) in the [Schema Object](#schema-object) that appears in the `schema` field of all three Objects.
22172217
Each of these fields has slightly different considerations.
22182218

22192219
The Schema Object's fields are used to show example values without regard to how they might be formatted as parameters or within media type representations.
22202220
The `examples` array is part of JSON Schema and is the preferred way to include examples in the Schema Object, while `example` is retained purely for compatibility with older versions of the OpenAPI Specification.
22212221

2222-
The mutually exclusive fields in the Parameter or Media Type Objects are used to show example values which SHOULD both match the schema and be formatted as they would appear as a serialized parameter or within a media type representation.
2223-
The exact serialization and encoding is determined by various fields in the Parameter Object, or in the Media Type Object's [Encoding Object](#encoding-object).
2222+
The mutually exclusive fields in the Parameter, Header, or Media Type Objects are used to show example values which SHOULD both match the schema and be formatted as they would appear as a serialized parameter, serialized header, or within a media type representation.
2223+
The exact serialization and encoding is determined by various fields in the Parameter Object, Header Object, or in the Media Type Object's [Encoding Object](#encoding-object).
22242224
Because examples using these fields represent the final serialized form of the data, they SHALL _override_ any `example` in the corresponding Schema Object.
22252225

2226-
The singular `example` field in the Parameter or Media Type Object is concise and convenient for simple examples, but does not offer any other advantages over using Example Objects under `examples`.
2226+
The singular `example` field in the Parameter, Header, or Media Type Object is concise and convenient for simple examples, but does not offer any other advantages over using Example Objects under `examples`.
22272227

22282228
Some examples cannot be represented directly in JSON or YAML.
22292229
For all three ways of providing examples, these can be shown as string values with any escaping necessary to make the string valid in the JSON or YAML format of documents that comprise the OpenAPI Description.

0 commit comments

Comments
 (0)