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: versions/3.0.md
+41-39Lines changed: 41 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -2003,23 +2003,27 @@ The `Link Object` is responsible for defining a possible operation based on a si
2003
2003
2004
2004
Field Name | Type | Description
2005
2005
---|:---:|---
2006
-
href | `string` | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field.
2007
-
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.
2008
-
parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `href`.
2009
-
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.
2010
-
description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/).
2006
+
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
2007
+
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.
2008
+
parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`.
2009
+
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.
2010
+
description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/).
2011
+
server | [Server Object](#serverObject) | a server object to be used by the target operation
2011
2012
2012
2013
This object can be extended with [Specification Extensions](#specificationExtensions).
2013
2014
2014
-
Locating a linked resource MAY be performed by either a `href` or `operationId`.
2015
+
Locating a linked resource MAY be performed by either a `operationRef` or `operationId`.
2015
2016
In the case of an `operationId`, it MUST be unique and resolved in the scope of the OAS document.
2016
-
Because of the potential for name clashes, consider the `href` syntax as the preferred method for specifications with external references.
2017
+
Because of the potential for name clashes, consider the `operationRef` syntax as the preferred
2018
+
method for specifications with external references.
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.
2021
-
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.
2022
-
In cases where a value is required, and a parameter is not supplied, the client MAY choose to not follow the link definition.
2022
+
Payload values are only available in parsable response payloads which match the advertised media
2023
+
type and for media types that can be referenced using a JSON Pointer fragment Id. In all cases,
2024
+
if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an
2025
+
empty value) and _not_ passed as a parameter to the linked resource. In cases where a value is
2026
+
required, and a parameter is not supplied, the client MAY choose to not follow the link definition.
2023
2027
2024
2028
##### Example
2025
2029
@@ -2126,51 +2130,46 @@ Can be used in a link like this:
2126
2130
2127
2131
```yaml
2128
2132
Addresses:
2129
-
href: '/users/{$request.path.id}/department'
2133
+
# the target link operationId
2134
+
operationId: getUserAddress
2135
+
parameters:
2136
+
# get the `id` field from the request path parameter named `id`
2137
+
userId: '{$request.path.id}'
2130
2138
```
2131
2139
2132
2140
Where the `$request.path.id` is the value passed in the request to `/users/{id}`.
2133
-
For a `id` value of `10101110`, the generated link would be:
2134
-
2135
-
```yaml
2136
-
href: '/users/10101110/department'
2137
-
```
2138
2141
2139
2142
##### Response Payload Example
2140
2143
2141
2144
```yaml
2142
2145
Addresses:
2143
-
href: '/users/{$response.body#/uuid}/address'
2144
-
```
2145
-
2146
-
Where the `$response.uuid` from the example above would yield the target:
Would produce three links with the `colorName` of `red`, `green`, and `blue`:
2167
2162
2168
-
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.
2163
+
As with all links, it is at the clients' discretion to follow them, neither
2164
+
permissions nor the ability to make a successful call to that link is guaranteed
2165
+
solely by the existence of a relationship.
2169
2166
2170
2167
2171
2168
##### Example
2172
2169
2173
-
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.
2170
+
The example below shows how relationships in the BitBucket API can be represented
2171
+
with the link schema. This example uses `operationId` values to link responses to
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