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: dev/oas.md
+49
Original file line number
Diff line number
Diff line change
@@ -1163,6 +1163,55 @@ name: pet
1163
1163
description: Pets operations
1164
1164
```
1165
1165
1166
+
#### <a name="examplesObject"></a>Examples Object
1167
+
1168
+
Anywhere an `example` may be given, allow a $ref object. This does mean that `example`, structurally, can be either a string primitive or an object, like `additionalProperties`.
1169
+
1170
+
In locations where the field being provided an `example` is a scalar value _or_ has it's content-type definition determined by a higher-level construct (a response payload, for example, uses the `produces` attribute to select the correct message format), the plural `examples` shall be used, and the payload format be specified as a key to the example.
1171
+
1172
+
In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. Tooling vendors may choose to valide compatibility automatically, and reject the example value(s) if they are not compatible.
1173
+
1174
+
```yaml
1175
+
# in a model
1176
+
definitions:
1177
+
properties:
1178
+
name:
1179
+
type: string
1180
+
example:
1181
+
$ref: http://foo.bar#/examples/name-example
1182
+
1183
+
# in a parameter, note the plural `examples` as the content-type is set by `consumes`:
A simple object to allow referencing other definitions in the specification. It can be used to reference parameters and responses that are defined at the top level for reuse.
0 commit comments