Class Operation
The Operation Object describes a single operation (such as GET, POST, PUT, DELETE) that can be performed on a path in Swagger 2.0. Operations define what actions can be taken, what parameters they accept, what they consume/produce, and what responses they return.
Swagger Specification:
The Operation Object is composed of the following fields:
tags (array of string) - A list of tags for API documentation controlsummary (string) - A short summary of what the operation doesdescription (string) - A verbose explanation of the operation behaviorexternalDocs (ExternalDocumentation
) - Additional external documentation for this operationoperationId (string) - Unique string used to identify the operationconsumes (array of string) - A list of MIME types the operation can consumeproduces (array of string) - A list of MIME types the operation can produceparameters (array ofParameterInfo
) - A list of parameters that are applicable for this operationresponses (map ofResponseInfo
, REQUIRED) - The list of possible responses as they are returned from executing this operationschemes (array of string) - The transfer protocol for the operation (overrides the Swagger-level schemes)deprecated (boolean) - Declares this operation to be deprecatedsecurity (array of map) - A declaration of which security schemes are applied for this operation
Example:
See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddConsumes
(Collection<MediaType> values) Bean property appender:consumes .addConsumes
(MediaType... value) Bean property fluent setter:consumes .addParameters
(Collection<ParameterInfo> values) Bean property fluent setter:parameters .addParameters
(ParameterInfo... value) Bean property fluent setter:parameters .addProduces
(Collection<MediaType> values) Bean property setter:produces .addProduces
(MediaType... value) Bean property fluent setter:produces .addResponse
(String statusCode, ResponseInfo response) Adds a single value to theresponses property.addSchemes
(String... value) Bean property fluent setter:schemes .addSchemes
(Collection<String> values) Bean property setter:schemes .addSecurity
(String scheme, String... alternatives) Same asaddSecurity(String, String...)
.addSecurity
(Collection<Map<String, List<String>>> value) Bean property adder:security .Bean property fluent adder:tags .addTags
(Collection<String> values) Bean property appender:tags .copy()
Make a deep copy of this object.<T> T
Generic property getter.Bean property getter:consumes .Bean property getter:deprecated .Bean property getter:description .Bean property getter:externalDocs .Bean property getter:operationId .getParameter
(String in, String name) Returns the parameter with the specified type and name.Bean property getter:parameters .Bean property getter:produces .getResponse
(int status) Returns the response info with the given status code.getResponse
(String status) Returns the response info with the given status code.Bean property getter:responses .Bean property getter:schemes .Bean property getter:security .Bean property getter:summary .getTags()
Bean property getter:tags .boolean
Bean property getter:deprecated .keySet()
Returns all the keys on this element.Generic property setter.setConsumes
(Collection<MediaType> value) Bean property setter:consumes .setConsumes
(MediaType... value) Bean property setter:consumes .setDeprecated
(Boolean value) Bean property setter:deprecated .setDescription
(String value) Bean property setter:description .Bean property setter:externalDocs .setOperationId
(String value) Bean property setter:operationId .setParameters
(Collection<ParameterInfo> value) Bean property setter:parameters .setParameters
(ParameterInfo... value) Bean property setter:parameters .setProduces
(Collection<MediaType> value) Bean property setter:produces .setProduces
(MediaType... value) Bean property setter:produces .setResponses
(Map<String, ResponseInfo> value) Bean property setter:responses .setSchemes
(String... value) Bean property setter:schemes .setSchemes
(Collection<String> value) Bean property setter:schemes .setSecurity
(Collection<Map<String, List<String>>> value) Bean property setter:security .final Operation
setSecurity
(Map<String, List<String>>... value) Bean property setter:security .setSummary
(String value) Bean property setter:summary .Bean property fluent setter:tags .setTags
(Collection<String> value) Bean property setter:tags .strict()
Sets strict mode on this bean.Sets strict mode on this bean.
-
Constructor Details
-
Operation
public Operation()Default constructor. -
Operation
Copy constructor.- Parameters:
copyFrom
- The object to copy.
-
-
Method Details
-
copy
Make a deep copy of this object.- Returns:
- A deep copy of this object.
-
getConsumes
Bean property getter:consumes .A list of MIME types the operation can consume.
- Returns:
- The property value, or
null if it is not set.
-
setConsumes
Bean property setter:consumes .A list of MIME types the operation can consume.
- Parameters:
value
- The new value for this property.
Values MUST be as described under Swagger Mime Types.
Can benull to unset the property.- Returns:
- This object.
-
setConsumes
Bean property setter:consumes .A list of MIME types the operation can consume.
- Parameters:
value
- The new value for this property.
Values MUST be as described under Swagger Mime Types.
Can benull to unset the property.- Returns:
- This object.
-
addConsumes
Bean property fluent setter:consumes .A list of MIME types the operation can consume.
- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
addConsumes
Bean property appender:consumes .A list of MIME types the operation can consume.
- Parameters:
values
- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
getDeprecated
Bean property getter:deprecated .Declares this operation to be deprecated.
- Returns:
- The property value, or
null if it is not set.
-
isDeprecated
Bean property getter:deprecated .Declares this operation to be deprecated.
- Returns:
- The property value, or
false if it is not set.
-
setDeprecated
Bean property setter:deprecated .Declares this operation to be deprecated.
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
getDescription
Bean property getter:description .A verbose explanation of the operation behavior.
- Returns:
- The property value, or
null if it is not set.
-
setDescription
Bean property setter:description .A verbose explanation of the operation behavior.
- Parameters:
value
- The new value for this property.
GFM syntax can be used for rich text representation.
Can benull to unset the property.- Returns:
- This object.
-
getExternalDocs
Bean property getter:externalDocs .Additional external documentation for this operation.
- Returns:
- The property value, or
null if it is not set.
-
setExternalDocs
Bean property setter:externalDocs .Additional external documentation for this operation.
- Parameters:
value
- The values to add to this property.
Can benull to unset the property.- Returns:
- This object.
-
getOperationId
Bean property getter:operationId .Unique string used to identify the operation.
- Returns:
- The property value, or
null if it is not set.
-
setOperationId
Bean property setter:operationId .Unique string used to identify the operation.
- Parameters:
value
- The new value for this property.
The id MUST be unique among all operations described in the API.
Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions.
Can benull to unset the property.- Returns:
- This object.
-
getParameters
Bean property getter:parameters .A list of parameters that are applicable for this operation.
Notes:
- If a parameter is already defined at the Path Item, the new definition will override it, but can never remove it.
- The list MUST NOT include duplicated parameters.
-
A unique parameter is defined by a combination of a
name andlocation . - The list can use the Swagger Reference Object to link to parameters that are defined at the Swagger Object's parameters.
-
There can be one
"body" parameter at most.
- Returns:
- The property value, or
null if it is not set.
-
getParameter
Returns the parameter with the specified type and name.- Parameters:
in
- The parameter in. Must not benull .name
- The parameter name. Can benull for parameter typebody .- Returns:
- The matching parameter info, or
null if not found.
-
setParameters
Bean property setter:parameters .A list of parameters that are applicable for this operation.
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setParameters
Bean property setter:parameters .A list of parameters that are applicable for this operation.
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
addParameters
Bean property fluent setter:parameters .A list of parameters that are applicable for this operation.
- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
addParameters
Bean property fluent setter:parameters .The parameters needed to send a valid API call.
- Parameters:
values
- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
getProduces
Bean property getter:produces .A list of MIME types the operation can produce.
- Returns:
- The property value, or
null if it is not set.
-
setProduces
Bean property setter:produces .A list of MIME types the operation can produce.
- Parameters:
value
- The new value for this property.
Value MUST be as described under Swagger Mime Types.
Can benull to unset the property.- Returns:
- This object.
-
setProduces
Bean property setter:produces .A list of MIME types the operation can produce.
- Parameters:
value
- The new value for this property.
Value MUST be as described under Swagger Mime Types.
Can benull to unset the property.- Returns:
- This object.
-
addProduces
Bean property fluent setter:produces .A list of MIME types the operation can produce.
- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
addProduces
Bean property setter:produces .A list of MIME types the operation can produce.
- Parameters:
values
- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
getResponses
Bean property getter:responses .The list of possible responses as they are returned from executing this operation.
- Returns:
- The property value, or
null if it is not set.
-
getResponse
Returns the response info with the given status code.- Parameters:
status
- The HTTP status code. Must not benull .- Returns:
- The response info, or
null if not found.
-
getResponse
Returns the response info with the given status code.- Parameters:
status
- The HTTP status code.- Returns:
- The response info, or
null if not found.
-
setResponses
Bean property setter:responses .The list of possible responses as they are returned from executing this operation.
- Parameters:
value
- The new value for this property.
Property value is required.
Can benull to unset the property.- Returns:
- This object.
-
addResponse
Adds a single value to theresponses property.- Parameters:
statusCode
- The HTTP status code. Must not benull .response
- The response description. Must not benull .- Returns:
- This object.
-
getSchemes
Bean property getter:schemes .The transfer protocol for the operation.
- Returns:
- The property value, or
null if it is not set.
-
setSchemes
Bean property setter:schemes .The transfer protocol for the operation.
- Parameters:
value
- The new value for this property.
Valid values:"http" "https" "ws" "wss"
Can benull to unset the property.- Returns:
- This object.
-
setSchemes
Bean property setter:schemes .The transfer protocol for the operation.
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
addSchemes
Bean property fluent setter:schemes .The transfer protocol for the operation.
- Parameters:
value
- The new value for this property.
String values can also be JSON arrays.- Returns:
- This object.
-
addSchemes
Bean property setter:schemes .The transfer protocol for the operation.
- Parameters:
values
- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
getSecurity
Bean property getter:security .A declaration of which security schemes are applied for this operation.
- Returns:
- The property value, or
null if it is not set.
-
setSecurity
Bean property setter:security .A declaration of which security schemes are applied for this operation.
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setSecurity
Bean property setter:security .A declaration of which security schemes are applied for this operation.
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
addSecurity
Same asaddSecurity(String, String...)
.- Parameters:
scheme
- The scheme name.
Must not benull .alternatives
- The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements).- Returns:
- This object.
-
addSecurity
Bean property adder:security .A declaration of which security schemes are applied for this operation.
- Parameters:
value
- The values to add to this property.
Must not benull .- Returns:
- This object.
-
getSummary
Bean property getter:summary .A short summary of what the operation does.
- Returns:
- The property value, or
null if it is not set.
-
setSummary
Bean property setter:summary .A short summary of what the operation does.
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
getTags
Bean property getter:tags .A list of tags for API documentation control.
Tags can be used for logical grouping of operations by resources or any other qualifier.- Returns:
- The property value, or
null if it is not set.
-
setTags
Bean property setter:tags .A list of tags for API documentation control.
Tags can be used for logical grouping of operations by resources or any other qualifier.- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setTags
Bean property fluent setter:tags .A list of tags for API documentation control.
Tags can be used for logical grouping of operations by resources or any other qualifier.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
addTags
Bean property fluent adder:tags .A list of tags for API documentation control.
Tags can be used for logical grouping of operations by resources or any other qualifier.- Parameters:
value
- The values to add to this property.- Returns:
- This object.
-
addTags
Bean property appender:tags .A list of tags for API documentation control.
- Parameters:
values
- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
get
Description copied from class:SwaggerElement
Generic property getter.Can be used to retrieve non-standard Swagger fields such as
"$ref" .- Overrides:
get
in classSwaggerElement
- Type Parameters:
T
- The datatype to cast the value to.- Parameters:
property
- The property name to retrieve.type
- The datatype to cast the value to.- Returns:
- The property value, or
null if the property does not exist or is not set.
-
set
Description copied from class:SwaggerElement
Generic property setter.Can be used to set non-standard Swagger fields such as
"$ref" .- Overrides:
set
in classSwaggerElement
- Parameters:
property
- The property name to set. Must not benull .value
- The new value for the property.- Returns:
- This object.
-
keySet
Description copied from class:SwaggerElement
Returns all the keys on this element.- Overrides:
keySet
in classSwaggerElement
- Returns:
- All the keys on this element.
Nevernull .
-
strict
Sets strict mode on this bean.- Overrides:
strict
in classSwaggerElement
- Returns:
- This object.
-
strict
Sets strict mode on this bean.- Overrides:
strict
in classSwaggerElement
- Parameters:
value
- The new value for this property.
Non-boolean values will be converted to boolean usingBoolean.
.valueOf (value.toString())
Can benull (interpreted asfalse ).- Returns:
- This object.
-