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 control
- summary (string) - A short summary of what the operation does
- description (string) - A verbose explanation of the operation behavior
- externalDocs (- ExternalDocumentation) - Additional external documentation for this operation
- operationId (string) - Unique string used to identify the operation
- consumes (array of string) - A list of MIME types the operation can consume
- produces (array of string) - A list of MIME types the operation can produce
- parameters (array of- ParameterInfo) - A list of parameters that are applicable for this operation
- responses (map of- ResponseInfo, REQUIRED) - The list of possible responses as they are returned from executing this operation
- schemes (array of string) - The transfer protocol for the operation (overrides the Swagger-level schemes)
- deprecated (boolean) - Declares this operation to be deprecated
- security (array of map) - A declaration of which security schemes are applied for this operation
Example:
   
   
See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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> TGeneric 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 .booleanBean 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 OperationsetSecurity(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- 
Operationpublic Operation()Default constructor.
- 
OperationCopy constructor.- Parameters:
- copyFrom- The object to copy.
 
 
- 
- 
Method Details- 
copyMake a deep copy of this object.- Returns:
- A deep copy of this object.
 
- 
getConsumesBean property getter:consumes .A list of MIME types the operation can consume. - Returns:
- The property value, or null if it is not set.
 
- 
setConsumesBean 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 be- null to unset the property.
- Returns:
- This object.
 
- 
setConsumesBean 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 be- null to unset the property.
- Returns:
- This object.
 
- 
addConsumesBean property fluent setter:consumes .A list of MIME types the operation can consume. - Parameters:
- value- The new value for this property.
- Returns:
- This object.
 
- 
addConsumesBean property appender:consumes .A list of MIME types the operation can consume. - Parameters:
- values- The values to add to this property.
 Ignored if- null .
- Returns:
- This object.
 
- 
getDeprecatedBean property getter:deprecated .Declares this operation to be deprecated. - Returns:
- The property value, or null if it is not set.
 
- 
isDeprecatedBean property getter:deprecated .Declares this operation to be deprecated. - Returns:
- The property value, or false if it is not set.
 
- 
setDeprecatedBean property setter:deprecated .Declares this operation to be deprecated. - Parameters:
- value- The new value for this property.
 Can be- null to unset the property.
- Returns:
- This object.
 
- 
getDescriptionBean property getter:description .A verbose explanation of the operation behavior. - Returns:
- The property value, or null if it is not set.
 
- 
setDescriptionBean 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 be- null to unset the property.
- Returns:
- This object.
 
- 
getExternalDocsBean property getter:externalDocs .Additional external documentation for this operation. - Returns:
- The property value, or null if it is not set.
 
- 
setExternalDocsBean property setter:externalDocs .Additional external documentation for this operation. - Parameters:
- value- The values to add to this property.
 Can be- null to unset the property.
- Returns:
- This object.
 
- 
getOperationIdBean property getter:operationId .Unique string used to identify the operation. - Returns:
- The property value, or null if it is not set.
 
- 
setOperationIdBean 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 be- null to unset the property.
- Returns:
- This object.
 
- 
getParametersBean 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.
 
- 
getParameterReturns the parameter with the specified type and name.- Parameters:
- in- The parameter in. Must not be- null .
- name- The parameter name. Can be- null for parameter type- body .
- Returns:
- The matching parameter info, or null if not found.
 
- 
setParametersBean property setter:parameters .A list of parameters that are applicable for this operation. - Parameters:
- value- The new value for this property.
 Can be- null to unset the property.
- Returns:
- This object.
 
- 
setParametersBean property setter:parameters .A list of parameters that are applicable for this operation. - Parameters:
- value- The new value for this property.
 Can be- null to unset the property.
- Returns:
- This object.
 
- 
addParametersBean 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.
 
- 
addParametersBean property fluent setter:parameters .The parameters needed to send a valid API call. - Parameters:
- values- The values to add to this property.
 Ignored if- null .
- Returns:
- This object.
 
- 
getProducesBean property getter:produces .A list of MIME types the operation can produce. - Returns:
- The property value, or null if it is not set.
 
- 
setProducesBean 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 be- null to unset the property.
- Returns:
- This object.
 
- 
setProducesBean 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 be- null to unset the property.
- Returns:
- This object.
 
- 
addProducesBean property fluent setter:produces .A list of MIME types the operation can produce. - Parameters:
- value- The new value for this property.
- Returns:
- This object.
 
- 
addProducesBean property setter:produces .A list of MIME types the operation can produce. - Parameters:
- values- The values to add to this property.
 Ignored if- null .
- Returns:
- This object.
 
- 
getResponsesBean 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.
 
- 
getResponseReturns the response info with the given status code.- Parameters:
- status- The HTTP status code. Must not be- null .
- Returns:
- The response info, or null if not found.
 
- 
getResponseReturns the response info with the given status code.- Parameters:
- status- The HTTP status code.
- Returns:
- The response info, or null if not found.
 
- 
setResponsesBean 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 be- null to unset the property.
- Returns:
- This object.
 
- 
addResponseAdds a single value to theresponses property.- Parameters:
- statusCode- The HTTP status code. Must not be- null .
- response- The response description. Must not be- null .
- Returns:
- This object.
 
- 
getSchemesBean property getter:schemes .The transfer protocol for the operation. - Returns:
- The property value, or null if it is not set.
 
- 
setSchemesBean property setter:schemes .The transfer protocol for the operation. - Parameters:
- value- The new value for this property.
 Valid values:- "http" 
- "https" 
- "ws" 
- "wss" 
 
 Can be- null to unset the property.
- Returns:
- This object.
 
- 
setSchemesBean property setter:schemes .The transfer protocol for the operation. - Parameters:
- value- The new value for this property.
 Can be- null to unset the property.
- Returns:
- This object.
 
- 
addSchemesBean 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.
 
- 
addSchemesBean property setter:schemes .The transfer protocol for the operation. - Parameters:
- values- The values to add to this property.
 Ignored if- null .
- Returns:
- This object.
 
- 
getSecurityBean 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.
 
- 
setSecurityBean property setter:security .A declaration of which security schemes are applied for this operation. - Parameters:
- value- The new value for this property.
 Can be- null to unset the property.
- Returns:
- This object.
 
- 
setSecurityBean property setter:security .A declaration of which security schemes are applied for this operation. - Parameters:
- value- The new value for this property.
 Can be- null to unset the property.
- Returns:
- This object.
 
- 
addSecuritySame asaddSecurity(String, String...).- Parameters:
- scheme- The scheme name.
 Must not be- null .
- 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.
 
- 
addSecurityBean 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 be- null .
- Returns:
- This object.
 
- 
getSummaryBean property getter:summary .A short summary of what the operation does. - Returns:
- The property value, or null if it is not set.
 
- 
setSummaryBean property setter:summary .A short summary of what the operation does. - Parameters:
- value- The new value for this property.
 Can be- null to unset the property.
- Returns:
- This object.
 
- 
getTagsBean 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.
 
- 
setTagsBean 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 be- null to unset the property.
- Returns:
- This object.
 
- 
setTagsBean 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.
 
- 
addTagsBean 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.
 
- 
addTagsBean property appender:tags .A list of tags for API documentation control. - Parameters:
- values- The values to add to this property.
 Ignored if- null .
- Returns:
- This object.
 
- 
getDescription copied from class:SwaggerElementGeneric property getter.Can be used to retrieve non-standard Swagger fields such as "$ref" .- Overrides:
- getin class- SwaggerElement
- 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.
 
- 
setDescription copied from class:SwaggerElementGeneric property setter.Can be used to set non-standard Swagger fields such as "$ref" .- Overrides:
- setin class- SwaggerElement
- Parameters:
- property- The property name to set. Must not be- null .
- value- The new value for the property.
- Returns:
- This object.
 
- 
keySetDescription copied from class:SwaggerElementReturns all the keys on this element.- Overrides:
- keySetin class- SwaggerElement
- Returns:
- All the keys on this element.
   
 Nevernull .
 
- 
strictSets strict mode on this bean.- Overrides:
- strictin class- SwaggerElement
- Returns:
- This object.
 
- 
strictSets strict mode on this bean.- Overrides:
- strictin class- SwaggerElement
- Parameters:
- value- The new value for this property.
 Non-boolean values will be converted to boolean using- Boolean..- valueOf (value.toString())
 Can be- null (interpreted as- false ).
- Returns:
- This object.
 
 
-