Skip to content

Commit 6244324

Browse files
committed
Un-deprecate fields
1 parent 51c1270 commit 6244324

File tree

2 files changed

+60
-39
lines changed

2 files changed

+60
-39
lines changed

src/oas.md

Lines changed: 58 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ Serializing with `schema` is NOT RECOMMENDED for `in: "cookie"` parameters, `in:
994994
| <a name="parameter-explode"></a>explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this field has no effect. When [`style`](#parameter-style) is `"form"`, the default value is `true`. For all other styles, the default value is `false`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined. |
995995
| <a name="parameter-allow-reserved"></a>allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.3), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#section-2.2), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are not allowed by the rules of the `in` destination or media type, or are [not allowed in the path by this specification](#path-templating); see Appendices [C](#appendix-c-using-rfc6570-based-serialization) and [E](#appendix-e-percent-encoding-and-form-media-types) for details. The default value is `false`. |
996996
| <a name="parameter-schema"></a>schema | [Schema Object](#schema-object) | The schema defining the type used for the parameter. |
997-
| <a name="parameter-example"></a>example | Any | **Deprecated**. Example of the parameter's potential value; see [Working With Examples](#working-with-examples). |
997+
| <a name="parameter-example"></a>example | Any | Example of the parameter's potential value; see [Working With Examples](#working-with-examples). |
998998
| <a name="parameter-examples"></a>examples | Map[ `string`, [Example Object](#example-object) \| [Reference Object](#reference-object)] | Examples of the parameter's potential value; see [Working With Examples](#working-with-examples). |
999999

10001000
See also [Appendix C: Using RFC6570-Based Serialization](#appendix-c-using-rfc6570-based-serialization) for additional guidance.
@@ -1276,7 +1276,7 @@ See [Working With Examples](#working-with-examples) for further guidance regardi
12761276
| ---- | :----: | ---- |
12771277
| <a name="media-type-schema"></a>schema | [Schema Object](#schema-object) | A schema describing the complete content of the request, response, parameter, or header. |
12781278
| <a name="media-type-item-schema"></a>itemSchema | [Schema Object](#schema-object) | A schema describing each item within a [sequential media type](#sequential-media-types). |
1279-
| <a name="media-type-example"></a>example | Any | **Deprecated**. Example of the media type; see [Working With Examples](#working-with-examples). |
1279+
| <a name="media-type-example"></a>example | Any | Example of the media type; see [Working With Examples](#working-with-examples). |
12801280
| <a name="media-type-examples"></a>examples | Map[ `string`, [Example Object](#example-object) \| [Reference Object](#reference-object)] | Examples of the media type; see [Working With Examples](#working-with-examples). |
12811281
| <a name="media-type-encoding"></a>encoding | Map[`string`, [Encoding Object](#encoding-object)] | A map between a property name and its encoding information, as defined under [Encoding Usage and Restrictions](#encoding-usage-and-restrictions). The `encoding` field SHALL only apply when the media type is `multipart` or `application/x-www-form-urlencoded`. If no Encoding Object is provided for a property, the behavior is determined by the default values documented for the Encoding Object. |
12821282

@@ -1920,7 +1920,10 @@ requestBody:
19201920
examples:
19211921
multipart:
19221922
description: |
1923-
The input example data for the
1923+
The input example data for the serialized value
1924+
is taken from the Schema Object `examples` fields
1925+
for the "id" and "addresses" field, and is a solid
1926+
red 2x2 pixel PNG for the "profileImage" field.
19241927
externalSerializedValue: ./examples/multipart
19251928
```
19261929
@@ -2216,37 +2219,34 @@ As further explained under [Working With Examples](#working-with-examples), this
22162219
| <a name="example-external-data-value"></a>externalDataValue | `string` | A URI that identifies the data example in a separate document, allowing for values not easily expressed in JSON or YAML. This is usually only needed when working with binary data. The value MUST be valid according to the relevant Schema Object. If this field is present, then `dataValue`, `value`, and `externalValue` MUST be absent. See also the rules for resolving [Relative URI References](#relative-references-in-api-description-uris). |
22172220
| <a name="example-serialized-value"></a>serializedValue | `string` | An example of the serialized form of the value, including encoding and escaping as described under [Validity of Data and Serialized Examples](#validity-of-data-and-serialized-examples). If `dataValue` or `externalDataValue` are present, then this field SHOULD contain the serialization of the given data. Otherwise, it SHOULD be the valid serialization of a data value that itself MUST be valid as described for `dataValue`. This field SHOULD NOT be used if the serialization format is JSON, as the data form is easier to work with. If this field is present, `externalSerializedValue`, `value`, and `externalValue` MUST be absent. |
22182221
| <a name="example-eternal-serialized-value"></a>externalSerializedValue | `string` | A URI that identifies the serialized example in a separate document, allowing for values not easily or readably expressed in JSON or YAML strings. If `dataValue` or `externalDataValue` are present, then this field SHOULD identify a serialization of the given data. Otherwise, the value SHOULD be a valid serialization as described for `serializedValue`. If this field is present, `serializedValue`, `value`, and `externalValue` MUST be absent. See also the rules for resolving [Relative References](#relative-references-in-api-description-uris). |
2219-
| <a name="example-value"></a>value | Any | **Deprecated**: It is implementation-defined whether this field is used for data or serialized forms. Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary. |
2220-
| <a name="example-external-value"></a>externalValue | `string` | **Deprecated**: It is implementation-defined whether this field is used for data or serialized forms. A URI that identifies the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `externalValue` field are mutually exclusive. See also the rules for resolving [Relative URI References](#relative-references-in-api-description-uris). |
2222+
| <a name="example-value"></a>value | Any | Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary. |
2223+
| <a name="example-external-value"></a>externalValue | `string` | A URI that identifies the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `externalValue` field are mutually exclusive. See the rules for resolving [Relative References](#relative-references-in-api-description-uris). |
22212224

22222225
This object MAY be extended with [Specification Extensions](#specification-extensions).
22232226

22242227
##### Working with Examples
22252228

22262229
Due to the history of example fields in both this specification and JSON Schema, there are a number of different ways to specify examples.
22272230

2228-
Outside of [Schema Objects](#schema-object), it is RECOMMENDED to use Example Objects with the `examples` (plural) fields available in the [Parameter](#parameter-object), [Header](#header-object), [Media Type](#media-type-object), and [Encoding](#encoding-object) Objects.
2231+
In the case of the non-Schema Object `example` (singular) fields, and of the `value` and`externalValue` fields of the Example Object, the example value SHOULD be compatible with the schema of its associated value.
2232+
Because of variations in tooling support for `value` and `externalValue` and ambiguity regarding what can be "easily" represented in JSON or YAML, the `dataValue` `externalDataValue`, `serializedValue`, and `externalSerializedValue` fields have been introduced.
2233+
For compatibility requirements of these new fields, see [Validity of Data and Serialized Examples](#validity-of-data-and-serialized-examples).
2234+
2235+
Tooling implementations MAY choose to validate compatibility automatically, and reject the example value(s) if incompatible.
22292236

22302237
###### Example Objects vs Other Fields Allowing Examples
22312238

2232-
However, there are several other ways to provide examples: The deprecated `example` (singular) field that is mutually exclusive with `examples` in all Objects that support both fields, and two keywords (the deprecated singular `example` and the current plural `examples`, which takes an array of examples) in the [Schema Object](#schema-object).
2239+
However, there are several other ways to provide examples: The `example` (singular) field that is mutually exclusive with `examples` in all Objects that support both fields, and two keywords (the deprecated singular `example` and the current plural `examples`, which takes an array of examples) in the [Schema Object](#schema-object).
22332240
When a schema is present alongside of the non-Schema Object `example` and `examples`, this results in four possible ways to specify an example.
22342241
Each of these fields has slightly different considerations.
22352242

22362243
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.
22372244
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.
22382245

22392246
The fields outside of the Schema Object can be used to show how data in either or both of serialized (`serializedValue`, `externalSerializedValue`) or unserialized (`dataValue`, `externalDataValue`) forms.
2240-
However, the `example` (singular) field is deprecated as it shares the same difficulties as the likewise deprecated `value` and `externalValue` fields of the Example Object.
22412247

22422248
Because examples using these non-Schema Object fields can show both the data and its serialization more clearly, they SHALL _override_ any `example` in the corresponding Schema Object.
22432249

2244-
###### Deprecated Example Object Fields
2245-
2246-
Historically, the Example Object's `value` and `externalValue` field and the non-Schema Object singular `example` fields were intended to show examples of the serialized form, while allowing JSON or YAML examples to be included inline rather than as serialized strings.
2247-
Due to some ambiguity in this guidance, these fields have been implemented in several different ways.
2248-
To preserve existing tooling behavior, these fields have been deemed to have implementation-defined behavior, and are deprecated in favor of the new unambiguous fields that allow OAD authors to choose which form(s) to show.
2249-
22502250
###### Validity of Data and Serialized Examples
22512251

22522252
The `dataValue` and `externalDataValue` fields are intended to show example data structures suitable for validation by the relevant Schema Object, against which they MUST be valid.
@@ -2559,7 +2559,7 @@ The `example` and `examples` fields are mutually exclusive, and if either is pre
25592559
| <a name="header-style"></a>style | `string` | Describes how the header value will be serialized. The default (and only legal value for headers) is `"simple"`. |
25602560
| <a name="header-explode"></a>explode | `boolean` | When this is true, header values of type `array` or `object` generate a single header whose value is a comma-separated list of the array items or key-value pairs of the map, see [Style Examples](#style-examples). For other data types this field has no effect. The default value is `false`. |
25612561
| <a name="header-schema"></a>schema | [Schema Object](#schema-object) \| [Reference Object](#reference-object) | The schema defining the type used for the header. |
2562-
| <a name="header-example"></a>example | Any | **Deprecated**. Example of the header's potential value; see [Working With Examples](#working-with-examples). |
2562+
| <a name="header-example"></a>example | Any | Example of the header's potential value; see [Working With Examples](#working-with-examples). |
25632563
| <a name="header-examples"></a>examples | Map[ `string`, [Example Object](#example-object) \| [Reference Object](#reference-object)] | Examples of the header's potential value; see [Working With Examples](#working-with-examples). |
25642564

25652565
See also [Appendix C: Using RFC6570-Based Serialization](#appendix-c-using-rfc6570-based-serialization) for additional guidance.
@@ -3351,7 +3351,8 @@ application/xml:
33513351
type: string
33523352
examples:
33533353
pets:
3354-
dataValue: "dog, cat, hamster"
3354+
dataValue:
3355+
animals: "dog, cat, hamster"
33553356
serializedValue: |
33563357
<document>
33573358
<animals>dog, cat, hamster</animals>
@@ -3373,7 +3374,8 @@ application/xml:
33733374
type: string
33743375
examples:
33753376
pets:
3376-
dataValue: [dog, cat, hamster]
3377+
dataValue:
3378+
animals: [dog, cat, hamster]
33773379
externalSerializedValue: ./examples/pets.xml
33783380
```
33793381

@@ -3402,7 +3404,8 @@ application/xml:
34023404
name: animal
34033405
examples:
34043406
pets:
3405-
dataValue: [dog, cat, hamster]
3407+
dataValue:
3408+
animals: [dog, cat, hamster]
34063409
externalSerializedValue: ./examples/pets.xml
34073410
```
34083411

@@ -3475,7 +3478,8 @@ application/xml:
34753478
name: animal
34763479
examples:
34773480
pets:
3478-
dataValue: [dog, cat, hamster]
3481+
dataValue:
3482+
animals: [dog, cat, hamster]
34793483
externalSerializedValue: ./examples/pets.xml
34803484
```
34813485

@@ -3508,7 +3512,8 @@ application/xml:
35083512
name: animal
35093513
examples:
35103514
pets:
3511-
dataValue: [dog, cat, hamster]
3515+
dataValue:
3516+
animals: [dog, cat, hamster]
35123517
externalSerializedValue: ./examples/pets.xml
35133518
```
35143519

@@ -3539,7 +3544,8 @@ application/xml:
35393544
type: string
35403545
examples:
35413546
pets:
3542-
dataValue: [dog, cat, hamster]
3547+
dataValue:
3548+
animals: [dog, cat, hamster]
35433549
externalSerializedValue: ./examples/pets.xml
35443550
```
35453551

@@ -3574,7 +3580,8 @@ application/xml:
35743580
name: animal
35753581
examples:
35763582
pets:
3577-
dataValue: [dog, cat, hamster]
3583+
dataValue:
3584+
animals: [dog, cat, hamster]
35783585
externalSerializedValue: ./examples/pets.xml
35793586
```
35803587

@@ -3610,7 +3617,8 @@ application/xml:
36103617
name: animal
36113618
examples:
36123619
pets:
3613-
dataValue: [dog, cat, hamster]
3620+
dataValue:
3621+
animals: [dog, cat, hamster]
36143622
externalSerializedValue: ./examples/pets.xml
36153623
```
36163624

@@ -3629,20 +3637,36 @@ Where `./examples/pets.xml` would be:
36293637
If we change the external element but not the internal ones:
36303638

36313639
```yaml
3632-
animals:
3633-
type: array
3634-
items:
3635-
type: string
3636-
xml:
3637-
name: aliens
3638-
wrapped: true
3640+
application/xml:
3641+
schema:
3642+
type: object
3643+
xml:
3644+
name: document
3645+
properties:
3646+
animals:
3647+
type: array
3648+
xml:
3649+
name: aliens
3650+
wrapped: true
3651+
items:
3652+
type: string
3653+
examples:
3654+
pets:
3655+
dataValue:
3656+
animals: [dog, cat, hamster]
3657+
externalSerializedValue: ./examples/pets.xml
36393658
```
36403659

3660+
Where `./examples/pets.xml` would be:
3661+
36413662
```xml
3642-
<aliens>
3643-
<aliens>value</aliens>
3644-
<aliens>value</aliens>
3645-
</aliens>
3663+
<document>
3664+
<aliens>
3665+
<aliens>dog</aliens>
3666+
<aliens>cat</aliens>
3667+
<aliens>hamster</aliens>
3668+
</aliens>
3669+
</document>
36463670
```
36473671

36483672
#### Security Scheme Object

src/schemas/validation/schema.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -650,10 +650,8 @@ $defs:
650650
externalSerializedValue:
651651
type: string
652652
format: uri-reference
653-
value:
654-
deprecated: true
653+
value: true
655654
externalValue:
656-
deprecated: true
657655
type: string
658656
format: uri-reference
659657
allOf:
@@ -1058,8 +1056,7 @@ $defs:
10581056

10591057
examples:
10601058
properties:
1061-
example:
1062-
deprecated: true
1059+
example: true
10631060
examples:
10641061
type: object
10651062
additionalProperties:

0 commit comments

Comments
 (0)