Interface Link
- All Superinterfaces:
Constructible
,Extensible<Link>
,Reference<Link>
The Link object represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.
For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.
A linked operation MUST be identified using either an operationRef or operationId. In the case of an operationId, it MUST be unique and resolved in the scope of the OAS document. Because of the potential for name clashes, the operationRef syntax is preferred for specifications with external references.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionaddParameter
(String name, Object parameter) Add a new parameter to the parameters property of this instance of Link.default Link
description
(String description) Sets this Link's description property to the given string.Returns the description property from a Link instance.Returns the operationId property for this instance of Link.Returns the operationRef property from a Link instance.Returns the parameters property from this instance of Link.Returns the requestBody property from a Link instance.Returns the server property from a Link instance.default Link
operationId
(String operationId) Sets this Link's operationId property to the given string.default Link
operationRef
(String operationRef) Sets this Link's operationRef property to the given string.default Link
parameters
(Map<String, Object> parameters) Sets this Link's parameters property to the given map and returns the modified Link instance.void
removeParameter
(String name) Remove a new parameter to the parameters property of this instance of Link.default Link
requestBody
(Object requestBody) Sets this Link's requestBody property to the given object.default Link
Sets this Link's server property to the given object.void
setDescription
(String description) Sets this Link's description property to the given string.void
setOperationId
(String operationId) Sets this Link's operationId property to the given string.void
setOperationRef
(String operationRef) Sets this Link's operationRef property to the given string.void
setParameters
(Map<String, Object> parameters) Sets this Link's parameters property to the given map.void
setRequestBody
(Object requestBody) Sets this Link's requestBody property to the given object.void
Sets this Link's server property to the given object.Methods inherited from interface org.eclipse.microprofile.openapi.models.Extensible
addExtension, extensions, getExtensions, removeExtension, setExtensions
-
Method Details
-
getServer
Server getServer()Returns the server property from a Link instance.- Returns:
- a server object to be used by the target operation
-
setServer
Sets this Link's server property to the given object.- Parameters:
server
- a server object to be used by the target operation
-
server
Sets this Link's server property to the given object.- Parameters:
server
- a server object to be used by the target operation- Returns:
- the current Link instance
-
getOperationRef
String getOperationRef()Returns the operationRef property from a Link instance.- Returns:
- a relative or absolute reference to an OAS operation
-
setOperationRef
Sets this Link's operationRef property to the given string. This field is mutually exclusive of the operationId field.- Parameters:
operationRef
- a relative or absolute reference to an OAS operation
-
operationRef
Sets this Link's operationRef property to the given string. This field is mutually exclusive of the operationId field.- Parameters:
operationRef
- a relative or absolute reference to an OAS operation- Returns:
- the current Link instance
-
getRequestBody
Object getRequestBody()Returns the requestBody property from a Link instance.- Returns:
- a literal value or runtime expression to use as a request body when calling the target operation
-
setRequestBody
Sets this Link's requestBody property to the given object.- Parameters:
requestBody
- a literal value or runtime expression to use as a request body when calling the target operation
-
requestBody
Sets this Link's requestBody property to the given object.- Parameters:
requestBody
- a literal value or runtime expression to use as a request body when calling the target operation- Returns:
- the current Link instance
-
getOperationId
String getOperationId()Returns the operationId property for this instance of Link.- Returns:
- the name of an existing, resolvable OAS operation
-
setOperationId
Sets this Link's operationId property to the given string. This field is mutually exclusive of the operationRef field.- Parameters:
operationId
- the name of an existing, resolvable OAS operation
-
operationId
Sets this Link's operationId property to the given string. This field is mutually exclusive of the operationRef field.- Parameters:
operationId
- the name of an existing, resolvable OAS operation- Returns:
- the current Link instance
-
getParameters
Returns the parameters property from this instance of Link. The key is the parameter name and the value is a constant or a runtime expression to be passed to the linked operation.- Returns:
- a copy Map (potentially immutable) representing parameters to pass to this link's operation
-
setParameters
Sets this Link's parameters property to the given map.- Parameters:
parameters
- a map representing parameters to pass to this link's operation as specified with operationId or identified via operationRef
-
parameters
Sets this Link's parameters property to the given map and returns the modified Link instance.- Parameters:
parameters
- a map representing parameters to pass to this link's operation as specified with operationId or identified via operationRef- Returns:
- current link instance
-
addParameter
Add a new parameter to the parameters property of this instance of Link.- Parameters:
name
- The name of the parameter. Can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id).parameter
- a constant or an expression to be evaluated at runtime and passed to the linked operation. null values will be rejected (implementation will throw an exception) or ignored.- Returns:
- the current Link instance
-
removeParameter
Remove a new parameter to the parameters property of this instance of Link.- Parameters:
name
- The name of the parameter. Can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id).
-
getDescription
String getDescription()Returns the description property from a Link instance.- Returns:
- a description of the link
-
setDescription
Sets this Link's description property to the given string.- Parameters:
description
- a description of the link
-
description
Sets this Link's description property to the given string.- Parameters:
description
- a description of the link- Returns:
- the current Link instance
-