Class Operation
The Operation Object describes a single operation (such as GET, POST, PUT, DELETE) that can be performed on a path. Operations are the core of the API specification, defining what actions can be taken, what parameters they accept, and what responses they return.
OpenAPI 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 behavior (CommonMark syntax may be used)externalDocs (ExternalDocumentation
) - Additional external documentation for this operationoperationId (string) - Unique string used to identify the operationparameters (array ofParameter
) - A list of parameters that are applicable for this operationrequestBody (RequestBodyInfo
) - The request body applicable for this operationresponses (map ofResponse
, REQUIRED) - The list of possible responses as they are returned from executing this operationcallbacks (map ofCallback
) - A map of possible out-of band callbacks related to the parent operationdeprecated (boolean) - Declares this operation to be deprecatedsecurity (array ofSecurityRequirement
) - A declaration of which security mechanisms can be used for this operationservers (array ofServer
) - An alternative server array to service this operation
Example:
See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddCallback
(String name, Callback callback) Bean property fluent setter:callbacks .addParameters
(Collection<Parameter> values) Bean property fluent setter:parameters .addParameters
(Parameter... values) Bean property fluent setter:parameters .addResponse
(String statusCode, Response response) Bean property fluent setter:responses .addSecurity
(Collection<SecurityRequirement> values) Bean property fluent setter:security .addSecurity
(SecurityRequirement... values) Bean property fluent setter:security .addServers
(Collection<Server> values) Bean property fluent setter:servers .addServers
(Server... values) Bean property fluent setter:servers .Bean property appender:tags .addTags
(Collection<String> values) Bean property appender:tags .copy()
Creates a copy of this object.<T> T
Generic property getter.Returns the callbacks map.Returns the deprecated flag.Returns the description.Returns the external documentation.Returns the operation ID.getParameter
(String in, String name) Returns the parameter with the specified type and name.Returns the parameters list.Returns the request body.getResponse
(int status) Returns the response with the given status code.getResponse
(String status) Returns the response with the given status code.Returns the responses map.Returns the security requirements list.Returns the servers list.Returns the summary.getTags()
Returns the tags list.keySet()
Returns all the keys on this element.Generic property setter.setCallbacks
(Map<String, Callback> value) Sets the callbacks map.setDeprecated
(Boolean value) Sets the deprecated flag.setDescription
(String value) Sets the description.Sets the external documentation.setOperationId
(String value) Sets the operation ID.setParameters
(List<Parameter> value) Sets the parameters list.setParameters
(Parameter... value) Sets the parameters list.setRequestBody
(RequestBodyInfo value) Sets the request body.setResponses
(Map<String, Response> value) Sets the responses map.setSecurity
(List<SecurityRequirement> value) Sets the security requirements list.setSecurity
(SecurityRequirement... value) Sets the security requirements list.setServers
(List<Server> value) Sets the servers list.setServers
(Server... value) Sets the servers list.setSummary
(String value) Sets the summary.Sets the tags list.Sets the tags list.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
-
getTags
Returns the tags list.- Returns:
- The tags list.
-
setTags
Sets the tags list.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
setTags
Sets the tags list.- Parameters:
value
- The new value for 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.
-
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.
-
addParameters
Bean property fluent setter:parameters .A list of parameters that are applicable for this operation.
- Parameters:
values
- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
addParameters
Bean property fluent setter:parameters .A list of parameters that are applicable for this operation.
- Parameters:
values
- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
addResponse
Bean property fluent setter:responses .The list of possible responses as they are returned from executing this operation.
- Parameters:
statusCode
- The status code for the response.
Must not benull .response
- The response object.
Must not benull .- Returns:
- This object.
-
addCallback
Bean property fluent setter:callbacks .A map of possible out-of band callbacks related to the parent operation.
- Parameters:
name
- The name of the callback.
Must not benull .callback
- The callback object.
Must not benull .- Returns:
- This object.
-
addSecurity
Bean property fluent setter:security .A declaration of which security mechanisms can be used for this operation.
- Parameters:
values
- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
addSecurity
Bean property fluent setter:security .A declaration of which security mechanisms can be used for this operation.
- Parameters:
values
- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
addServers
Bean property fluent setter:servers .An alternative server array to service this operation.
- Parameters:
values
- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
addServers
Bean property fluent setter:servers .An alternative server array to service this operation.
- Parameters:
values
- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
getSummary
Returns the summary.- Returns:
- The summary.
-
setSummary
Sets the summary.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
getDescription
Returns the description.- Returns:
- The description.
-
setDescription
Sets the description.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
getOperationId
Returns the operation ID.- Returns:
- The operation ID.
-
setOperationId
Sets the operation ID.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
getExternalDocs
Returns the external documentation.- Returns:
- The external documentation.
-
setExternalDocs
Sets the external documentation.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
getParameters
Returns the parameters list.- Returns:
- The parameters list.
-
getParameter
Returns the parameter with the specified type and name.- Parameters:
in
- The parameter in. Must not benull .name
- The parameter name. Must not benull .- Returns:
- The matching parameter, or
null if not found.
-
setParameters
Sets the parameters list.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
setParameters
Sets the parameters list.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
getRequestBody
Returns the request body.- Returns:
- The request body.
-
setRequestBody
Sets the request body.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
getResponses
Returns the responses map.- Returns:
- The responses map.
-
getResponse
Returns the response with the given status code.- Parameters:
status
- The HTTP status code. Must not benull .- Returns:
- The response, or
null if not found.
-
getResponse
Returns the response with the given status code.- Parameters:
status
- The HTTP status code.- Returns:
- The response, or
null if not found.
-
setResponses
Sets the responses map.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
getCallbacks
Returns the callbacks map.- Returns:
- The callbacks map.
-
setCallbacks
Sets the callbacks map.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
getDeprecated
Returns the deprecated flag.- Returns:
- The deprecated flag.
-
setDeprecated
Sets the deprecated flag.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
getSecurity
Returns the security requirements list.- Returns:
- The security requirements list.
-
setSecurity
Sets the security requirements list.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
setSecurity
Sets the security requirements list.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
getServers
Returns the servers list.- Returns:
- The servers list.
-
setServers
Sets the servers list.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
setServers
Sets the servers list.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
copy
Creates a copy of this object.- Returns:
- A copy of this object.
-
get
Description copied from class:OpenApiElement
Generic property getter.Can be used to retrieve non-standard Swagger fields such as
"$ref" .- Overrides:
get
in classOpenApiElement
- 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:OpenApiElement
Generic property setter.Can be used to set non-standard Swagger fields such as
"$ref" .- Overrides:
set
in classOpenApiElement
- 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:OpenApiElement
Returns all the keys on this element.- Overrides:
keySet
in classOpenApiElement
- Returns:
- All the keys on this element.
Nevernull .
-
strict
Description copied from class:OpenApiElement
Sets strict mode on this bean.- Overrides:
strict
in classOpenApiElement
- Returns:
- This object
-
strict
Description copied from class:OpenApiElement
Sets strict mode on this bean.- Overrides:
strict
in classOpenApiElement
- 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
-