Description
Provide capabilities to replace the entire path structure via a response link mechanism (see #742). The path structure being returned may be a multi-segment path. There would be two options for replacing the path. They would be:
- Replace the path only without any change in the host or base path.
- Replace the path while overriding the host and base path.
In each case, the URI being returned from the response link is a concrete path (i.e., traversable) which may or may not include a scheme and host. It is not a template.
This allows for use cases where the link returned from a response may include a full URI (scheme, host, and path). We have key API specifications where this will be the case.
An example for how Option 1 and Option 2 may work is included below. Option 1 simply replaces the path without any changes to the host or base path already defined in the specification. Option 2 could be defined using "override host" and "override basepath" conditions as part of the parameter definition. In the example below for Option 2, it would be expected that the {version} variable would contain the scheme, host, basepath, and path:
Option 1
paths:
/{version}:
get:
operation id: componentVersion
parameters:
- name: version
type: string
in: path
required: true
responses:
200:
description: Component Version
schema:
$ref: '#/components/definitions/componentVersion'
/metadata:
post:
operationId: metadata
parameters:
- name: name
type: string
in: query
required: true
- name: value
type: string
in: query
required: true
responses:
200:
description: component metadata
schema:
$ref: '#/components/definitions/metadata'
links:
version:
#returns the version of a component
operationID: componentVersion
parameters:
- version: $response.header.links.version
Option 2
paths:
/{version}:
get:
operation id: componentVersion
parameters:
- name: version
type: string
in: path
override host: true
override basepath: true
required: true
responses:
200:
description: Component Version
schema:
$ref: '#/components/definitions/componentVersion'
/metadata:
post:
operationId: metadata
parameters:
- name: name
type: string
in: query
required: true
- name: value
type: string
in: query
required: true
responses:
200:
description: component metadata
schema:
$ref: '#/components/definitions/metadata'
links:
version:
#returns the version of a component
operationID: componentVersion
parameters:
- version: $response.header.links.version