Skip to content

Commit edc99b3

Browse files
committed
updated to support alternate link URLs, for #783
1 parent 8e516eb commit edc99b3

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

versions/3.0.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,8 @@ The `Link Object` is responsible for defining a possible operation based on a si
11731173

11741174
Field Name | Type | Description
11751175
---|:---:|---
1176-
href | url | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field.
1176+
href | url | a relative or absolute URL to a linked resource definition. This field is mutually exclusive with the `operationId` field.
1177+
url | url | a relative or absolute URL representing the target location for the link operation. This is used to override the `{scheme}://{host}/{basePath}` defined at the global level for the linked operation.
11771178
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 in the OAS.
11781179
parameters | Link Parameters Object | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`.
11791180
headers | Link Headers Object | an Object representing headers to pass to the linked resource.
@@ -1184,6 +1185,23 @@ Locating a linked resource may be performed by either a `href` or `operationId`.
11841185
In the case of an `operationId`, it must be unique and resolved in the scope of the OAS document.
11851186
Because of the potential for name clashes, consider the `href` syntax as the preferred method for specifications with external references.
11861187

1188+
When the `url` attribute is provided, the target host may be overridden by the value provided. For example:
1189+
1190+
```
1191+
components:
1192+
links:
1193+
UserRepositories:
1194+
operationId: getRepositoriesByOwner
1195+
url: $responseHeaders.link
1196+
definitions:
1197+
user:
1198+
type: object
1199+
```
1200+
1201+
will extract the URL from the response header named `link`. If an absolute URL is provided, it will be used instead of the server / path provided in the target operation. Parameters _may_ be provided as well. If a `path` parameter is provided, it shall be ignored unless the `url` value contains a matching location for substitution. If query parameters are provided in the `url` value, they will be interpreted per the operation definition, and the absence of a required query parameter will result in an invalid request.
1202+
1203+
When a relative path is provided in the `url` attribute, the host defined in the specification will be used.
1204+
11871205
#### <a name="responsePayload"></a>Response Payload Values
11881206

11891207
Payload values are only available in parseable response payloads which match the advertised media-type.

0 commit comments

Comments
 (0)