
io.swagger.v3.oas.models.Operation Maven / Gradle / Ivy
package io.swagger.v3.oas.models;
import io.swagger.v3.oas.models.annotations.OpenAPI31;
import io.swagger.v3.oas.models.callbacks.Callback;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.oas.models.responses.ApiResponses;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.servers.Server;
import java.util.*;
/**
* Operation
*
* @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#operationObject"
* @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#operationObject"
*/
public class Operation {
private List tags = null;
private String summary = null;
private String description = null;
private ExternalDocumentation externalDocs = null;
private String operationId = null;
private List parameters = null;
private RequestBody requestBody = null;
private ApiResponses responses = null;
private Map callbacks = null;
private Boolean deprecated = null;
private List security = null;
private List servers = null;
private Map extensions = null;
/**
* returns the tags property from a Operation instance.
*
* @return List<String> tags
**/
public List getTags() {
return tags;
}
public void setTags(List tags) {
this.tags = tags;
}
public Operation tags(List tags) {
this.tags = tags;
return this;
}
public Operation addTagsItem(String tagsItem) {
if (this.tags == null) {
this.tags = new ArrayList<>();
}
this.tags.add(tagsItem);
return this;
}
/**
* returns the summary property from a Operation instance.
*
* @return String summary
**/
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
public Operation summary(String summary) {
this.summary = summary;
return this;
}
/**
* returns the description property from a Operation instance.
*
* @return String description
**/
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Operation description(String description) {
this.description = description;
return this;
}
/**
* returns the externalDocs property from a Operation instance.
*
* @return ExternalDocumentation externalDocs
**/
public ExternalDocumentation getExternalDocs() {
return externalDocs;
}
public void setExternalDocs(ExternalDocumentation externalDocs) {
this.externalDocs = externalDocs;
}
public Operation externalDocs(ExternalDocumentation externalDocs) {
this.externalDocs = externalDocs;
return this;
}
/**
* returns the operationId property from a Operation instance.
*
* @return String operationId
**/
public String getOperationId() {
return operationId;
}
public void setOperationId(String operationId) {
this.operationId = operationId;
}
public Operation operationId(String operationId) {
this.operationId = operationId;
return this;
}
/**
* returns the parameters property from a Operation instance.
*
* @return List<Parameter> parameters
**/
public List getParameters() {
return parameters;
}
public void setParameters(List parameters) {
this.parameters = parameters;
}
public Operation parameters(List parameters) {
this.parameters = parameters;
return this;
}
public Operation addParametersItem(Parameter parametersItem) {
if (this.parameters == null) {
this.parameters = new ArrayList<>();
}
this.parameters.add(parametersItem);
return this;
}
/**
* returns the requestBody property from a Operation instance.
*
* @return RequestBody requestBody
**/
public RequestBody getRequestBody() {
return requestBody;
}
public void setRequestBody(RequestBody requestBody) {
this.requestBody = requestBody;
}
public Operation requestBody(RequestBody requestBody) {
this.requestBody = requestBody;
return this;
}
/**
* returns the responses property from a Operation instance.
*
* @return ApiResponses responses
**/
public ApiResponses getResponses() {
return responses;
}
public void setResponses(ApiResponses responses) {
this.responses = responses;
}
public Operation responses(ApiResponses responses) {
this.responses = responses;
return this;
}
/**
* returns the callbacks property from a Operation instance.
*
* @return Callbacks callbacks
**/
public Map getCallbacks() {
return callbacks;
}
public void setCallbacks(Map callbacks) {
this.callbacks = callbacks;
}
public Operation callbacks(Map callbacks) {
this.callbacks = callbacks;
return this;
}
public Operation addCallback(String key, Callback callback) {
if (this.callbacks == null) {
this.callbacks = new LinkedHashMap<>();
}
this.callbacks.put(key, callback);
return this;
}
/**
* returns the deprecated property from a Operation instance.
*
* @return Boolean deprecated
**/
public Boolean getDeprecated() {
return deprecated;
}
public void setDeprecated(Boolean deprecated) {
this.deprecated = deprecated;
}
public Operation deprecated(Boolean deprecated) {
this.deprecated = deprecated;
return this;
}
/**
* returns the security property from a Operation instance.
*
* @return List<SecurityRequirement> security
**/
public List getSecurity() {
return security;
}
public void setSecurity(List security) {
this.security = security;
}
public Operation security(List security) {
this.security = security;
return this;
}
public Operation addSecurityItem(SecurityRequirement securityItem) {
if (this.security == null) {
this.security = new ArrayList<>();
}
this.security.add(securityItem);
return this;
}
/**
* returns the servers property from a Operation instance.
*
* @return List<Server> servers
**/
public List getServers() {
return servers;
}
public void setServers(List servers) {
this.servers = servers;
}
public Operation servers(List servers) {
this.servers = servers;
return this;
}
public Operation addServersItem(Server serversItem) {
if (this.servers == null) {
this.servers = new ArrayList<>();
}
this.servers.add(serversItem);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
var operation = (Operation) o;
return Objects.equals(this.tags, operation.tags) &&
Objects.equals(this.summary, operation.summary) &&
Objects.equals(this.description, operation.description) &&
Objects.equals(this.externalDocs, operation.externalDocs) &&
Objects.equals(this.operationId, operation.operationId) &&
Objects.equals(this.parameters, operation.parameters) &&
Objects.equals(this.requestBody, operation.requestBody) &&
Objects.equals(this.responses, operation.responses) &&
Objects.equals(this.callbacks, operation.callbacks) &&
Objects.equals(this.deprecated, operation.deprecated) &&
Objects.equals(this.security, operation.security) &&
Objects.equals(this.servers, operation.servers) &&
Objects.equals(this.extensions, operation.extensions);
}
@Override
public int hashCode() {
return Objects.hash(
tags,
summary,
description,
externalDocs,
operationId,
parameters,
requestBody,
responses,
callbacks,
deprecated,
security,
servers,
extensions
);
}
public Map getExtensions() {
return extensions;
}
public void setExtensions(Map extensions) {
this.extensions = extensions;
}
public void addExtension(String name, Object value) {
if (name == null || !name.startsWith("x-")) {
return;
}
if (this.extensions == null) {
this.extensions = new java.util.LinkedHashMap<>();
}
this.extensions.put(name, value);
}
@OpenAPI31
public void addExtension31(String name, Object value) {
if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) {
return;
}
addExtension(name, value);
}
public Operation extensions(Map extensions) {
this.extensions = extensions;
return this;
}
@Override
public String toString() {
return "class Operation {\n" +
" tags: " + toIndentedString(tags) + "\n" +
" summary: " + toIndentedString(summary) + "\n" +
" description: " + toIndentedString(description) + "\n" +
" externalDocs: " + toIndentedString(externalDocs) + "\n" +
" operationId: " + toIndentedString(operationId) + "\n" +
" parameters: " + toIndentedString(parameters) + "\n" +
" requestBody: " + toIndentedString(requestBody) + "\n" +
" responses: " + toIndentedString(responses) + "\n" +
" callbacks: " + toIndentedString(callbacks) + "\n" +
" deprecated: " + toIndentedString(deprecated) + "\n" +
" security: " + toIndentedString(security) + "\n" +
" servers: " + toIndentedString(servers) + "\n" +
"}";
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy