Skip to content
This repository was archived by the owner on Jul 1, 2021. It is now read-only.

Commit e8f399c

Browse files
committed
addresses feedback from OAI/TDC call
1 parent ff0d8d2 commit e8f399c

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

versions/3.0.md

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,11 +1868,11 @@ The `Link Object` is responsible for defining a possible operation based on a si
18681868
Field Name | Type | Description
18691869
---|:---:|---
18701870
operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition
1871-
operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS.
1872-
parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `href`.
1873-
headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override.
1874-
description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/).
1875-
server | [Server Object](#serverObject) | a server object to be used by the target operation
1871+
operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS.
1872+
parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`.
1873+
headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override.
1874+
description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/).
1875+
server | [Server Object](#serverObject) | a server object to be used by the target operation
18761876

18771877
This object can be extended with [Specification Extensions](#specificationExtensions).
18781878

@@ -1883,9 +1883,11 @@ method for specifications with external references.
18831883

18841884
##### <a name="responsePayload"></a>Response Payload Values
18851885

1886-
Payload values are only available in parsable response payloads which match the advertised media type and for media types that can be referenced using a JSON Pointer fragment Id.
1887-
In all cases, if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an empty value) and _not_ passed as a parameter to the linked resource.
1888-
In cases where a value is required, and a parameter is not supplied, the client MAY choose to not follow the link definition.
1886+
Payload values are only available in parsable response payloads which match the advertised media
1887+
type and for media types that can be referenced using a JSON Pointer fragment Id. In all cases,
1888+
if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an
1889+
empty value) and _not_ passed as a parameter to the linked resource. In cases where a value is
1890+
required, and a parameter is not supplied, the client MAY choose to not follow the link definition.
18891891

18901892
##### Example
18911893

@@ -1992,51 +1994,46 @@ Can be used in a link like this:
19921994

19931995
```yaml
19941996
Addresses:
1995-
href: '/users/{$request.path.id}/department'
1997+
# the target link operationId
1998+
operationId: getUserAddress
1999+
parameters:
2000+
# get the `id` field from the request path parameter named `id`
2001+
userId: '{$request.path.id}'
19962002
```
19972003
19982004
Where the `$request.path.id` is the value passed in the request to `/users/{id}`.
1999-
For a `id` value of `10101110`, the generated link would be:
2000-
2001-
```yaml
2002-
href: '/users/10101110/department'
2003-
```
20042005

20052006
##### Response Payload Example
20062007

20072008
```yaml
20082009
Addresses:
2009-
href: '/users/{$response.body#/uuid}/address'
2010-
```
2011-
2012-
Where the `$response.uuid` from the example above would yield the target:
2013-
2014-
2015-
```yaml
2016-
href: '/users/df71a505-07bc-458a-a5c0-73c0340d1ec7/address'
2010+
operationId: getUserAddressByUUID
2011+
parameters:
2012+
# get the `id` field from the request path parameter named `id`
2013+
userUuid: '{$response.body#/uuid}'
20172014
```
20182015
20192016
And the array example:
20202017
20212018
```yaml
20222019
ColorSelection:
2023-
href: 'http://colors.my-server.com/colors/{$response.body#/color}'
2020+
operationId: getColorSample
2021+
parameters:
2022+
colorName: '{$response.body#/color}'
20242023
```
20252024
2026-
Would produce the following links:
2027-
2028-
```yaml
2029-
href: 'http://colors.my-server.com/colors/red'
2030-
href: 'http://colors.my-server.com/colors/green'
2031-
href: 'http://colors.my-server.com/colors/blue'
2032-
```
2025+
Would produce three links with the `colorName` of `red`, `green`, and `blue`:
20332026

2034-
As with all links, it is at the clients' discretion to follow them, neither permissions nor the ability to make a successful call to that link is guaranteed solely by the existence of a relationship.
2027+
As with all links, it is at the clients' discretion to follow them, neither
2028+
permissions nor the ability to make a successful call to that link is guaranteed
2029+
solely by the existence of a relationship.
20352030

20362031

20372032
##### Example
20382033

2039-
The example below shows how relationships in the BitBucket API can be represented with the link schema. This example uses `operationId` values to link responses to possible operations.
2034+
The example below shows how relationships in the BitBucket API can be represented
2035+
with the link schema. This example uses `operationId` values to link responses to
2036+
possible operations.
20402037

20412038
```yaml
20422039
paths:
@@ -2209,7 +2206,7 @@ components:
22092206
# executes /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge
22102207
operationId: mergePullRequest
22112208
parameters:
2212-
username: $response.body#/user/username # Should be $response.author.username?
2209+
username: $response.body#/author/username
22132210
slug: $response.body#/repository/slug
22142211
pid: $response.body#/id
22152212
schemas:
@@ -2240,26 +2237,29 @@ components:
22402237
$ref: '#/components/schemas/user'
22412238
```
22422239

2243-
As references to `operationId` MAY NOT be possible (the `operationId` is an optional value), references MAY also be made through a relative `href`:
2240+
As references to `operationId` MAY NOT be possible (the `operationId` is an optional
2241+
value), references MAY also be made through a relative `operationRef`:
22442242

22452243
```yaml
22462244
components:
22472245
links:
22482246
UserRepositories:
22492247
# returns array of '#/components/schemas/repository'
2250-
href: '/2.0/repositories/{$response.body#/username}'
2248+
operationRef: '#paths~12.0~1repositories~1{$response.body#/username}'
22512249
```
22522250

2253-
or an absolute `href`:
2251+
or an absolute `operationRef`:
22542252

22552253
```yaml
22562254
components:
22572255
links:
22582256
UserRepositories:
22592257
# returns array of '#/components/schemas/repository'
2260-
href: 'https://na2.gigantic-server.com/2.0/repositories/{$response.body#/username}'
2258+
href: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{$response.body#/username}'
22612259
```
22622260

2261+
Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when
2262+
using JSON references.
22632263

22642264
#### <a name="linkParametersObject"></a>Link Parameters Object
22652265
Using the `operationId` to reference an operation in the definition has many benefits, including the ability to define media type options, security requirements, response and error payloads.

0 commit comments

Comments
 (0)