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
This is the first of several appendixes to be added to clarify
the most obscure details of Parameter Object and Encoding Object
serialization.
This clarifies the correspondence between OAS fields and RFC6570
operators, and acknowledges that some field values and combinations
do not have analogues. It provides further guidance for how to
use RFC6570 implementations to support these configurations.
This includes a SHOULD directive regarding using RFC6570 expansion
with the non-RFC6570 styles, as the use of "explode" and
"allowReserved" does not otherwise make any sense. It perhaps
could be a MUST.
This also includes an acknowledgement of ambiguity in reconciling
`contentType` and `style` in the Encoding Object, make the behavior
Copy file name to clipboardExpand all lines: versions/3.0.4.md
+52Lines changed: 52 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1060,6 +1060,8 @@ Field Name | Type | Description
1060
1060
<a name="parameterExample"></a>example | Any | Example of the parameter's potential value. The example SHOULD match the specified schema and encoding properties if present. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` that contains an example, the `example` value SHALL _override_ the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.
1061
1061
<a name="parameterExamples"></a>examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the parameter's potential value. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` that contains an example, the `examples` value SHALL _override_ the example provided by the schema.
1062
1062
1063
+
See also [Appendix B: Using RFC6570 Implementations](#usingRFC6570Implementations) for additional guidance.
1064
+
1063
1065
###### Fixed Fields and considerations for use with `content`
1064
1066
1065
1067
For more complex scenarios, the [`content`](#parameterContent) property can define the media type and schema of the parameter, as well as give examples of its use.
@@ -3495,3 +3497,53 @@ Version | Date | Notes
3495
3497
1.2 | 2014-03-14 | Initial release of the formal document.
3496
3498
1.1 | 2012-08-22 | Release of Swagger 1.1
3497
3499
1.0 | 2011-08-10 | First release of the Swagger Specification
3500
+
3501
+
## <a name="usingRFC6570Implementations"></a>Appendix B: Using RFC6570 Implementations
3502
+
3503
+
Serialization is defined in terms of RFC6570 URI Templates in two scenarios:
3504
+
3505
+
Object | Condition
3506
+
------ | ---------
3507
+
Parameter Object | When `schema` is present
3508
+
Encoding Object | When encoding for `application/x-www-form-urlencoded` and any of `style`, `explode`, or `allowReserved` are used
3509
+
3510
+
Implementations of this specification MAY use an implementation of RFC6570 to perform variable expansion, however, some caveats apply.
3511
+
3512
+
### Equivalences Between Fields and RFC6570 Operators
3513
+
3514
+
Certain field values translate to RFC6570 operators (or lack thereof):
3515
+
3516
+
field | value | operator
3517
+
----- | ----- | --------
3518
+
style | simple | _n/a_
3519
+
style | matrix | `;`
3520
+
style | label | `.`
3521
+
style | form | `?`
3522
+
allowReserved | `false` | _n/a_
3523
+
allowReserved | `true` | `+`
3524
+
explode | `false` | _n/a_
3525
+
explode | `true` | `*`
3526
+
3527
+
Multiple `style: form` parameters are equivalent to a single RFC6570 "varspec" using the `?` operator:
3528
+
3529
+
```YAML
3530
+
- name: foo
3531
+
in: query
3532
+
schema:
3533
+
type: object
3534
+
explode: true
3535
+
- name: bar
3536
+
in: query
3537
+
schema:
3538
+
type: string
3539
+
```
3540
+
3541
+
This example is equivalent to RFC6570's `{?foo*,bar}`, and ***NOT*** `{?foo*}{&bar}`.
3542
+
The `&` operator has no equivalent in OpenAPI:
3543
+
3544
+
### Non-RFC6570 Field Values and Combinations
3545
+
3546
+
Configurations with no direct RFC6570 equivalence SHOULD also be handled according to RFC6570.
3547
+
Implementations MAY pass individual names and values to RFC6570 regular or reserved expansion (based on `allowReserved`), and then assemble the results into a string with the appropriate deliiters.
3548
+
3549
+
This includes the styles `pipeDelimited`, `spaceDelimited`, and `deepObject`, as well as the combination of the `form` style with `allowReserved: true`.
0 commit comments