org.openapi4j.parser.model.v3.Operation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openapi-parser Show documentation
Show all versions of openapi-parser Show documentation
openapi4j schema parser & validator
package org.openapi4j.parser.model.v3;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.openapi4j.core.model.OAIContext;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@SuppressWarnings("unused")
public class Operation extends AbsExtendedOpenApiSchema {
private List tags;
private String summary;
private String description;
private ExternalDocs externalDocs;
private String operationId;
private List parameters;
private RequestBody requestBody;
private Map responses;
private Map callbacks;
private Boolean deprecated;
@JsonProperty("security")
private List securityRequirements;
private List servers;
// Tag
public List getTags() {
return tags;
}
public Operation setTags(List tags) {
this.tags = tags;
return this;
}
public boolean hasTags() {
return tags != null;
}
public Operation addTag(String tag) {
tags = listAdd(tags, tag);
return this;
}
public Operation insertTag(int index, String tag) {
tags = listAdd(tags, index, tag);
return this;
}
public Operation removeTag(String tag) {
listRemove(tags, tag);
return this;
}
// Summary
public String getSummary() {
return summary;
}
public Operation setSummary(String summary) {
this.summary = summary;
return this;
}
// Description
public String getDescription() {
return description;
}
public Operation setDescription(String description) {
this.description = description;
return this;
}
// ExternalDocs
public ExternalDocs getExternalDocs() {
return externalDocs;
}
public Operation setExternalDocs(ExternalDocs externalDocs) {
this.externalDocs = externalDocs;
return this;
}
// OperationId
public String getOperationId() {
return operationId;
}
public Operation setOperationId(String operationId) {
this.operationId = operationId;
return this;
}
// Parameter
public List getParameters() {
return parameters;
}
public Operation setParameters(List parameters) {
this.parameters = parameters;
return this;
}
public boolean hasParameters() {
return parameters != null;
}
public Operation addParameter(Parameter parameter) {
parameters = listAdd(parameters, parameter);
return this;
}
public Operation insertParameter(int index, Parameter parameter) {
parameters = listAdd(parameters, index, parameter);
return this;
}
public Operation removeParameter(Parameter parameter) {
listRemove(parameters, parameter);
return this;
}
public List getParametersIn(OAIContext context, String in) {
return ParameterUtil.getIn(context, parameters, in);
}
// RequestBody
public RequestBody getRequestBody() {
return requestBody;
}
public Operation setRequestBody(RequestBody requestBody) {
this.requestBody = requestBody;
return this;
}
// Response
public Map getResponses() {
return responses;
}
public Operation setResponses(Map responses) {
this.responses = responses;
return this;
}
public boolean hasResponse(String name) {
return mapHas(responses, name);
}
public Response getResponse(String name) {
return mapGet(responses, name);
}
public Operation setResponse(String name, Response response) {
if (responses == null) {
responses = new HashMap<>();
}
responses.put(name, response);
return this;
}
public Operation removeResponse(String name) {
mapRemove(responses, name);
return this;
}
// Callback
public Map getCallbacks() {
return callbacks;
}
public Operation setCallbacks(Map callbacks) {
this.callbacks = callbacks;
return this;
}
public boolean hasCallback(String name) {
return mapHas(callbacks, name);
}
public Callback getCallback(String name) {
return mapGet(callbacks, name);
}
public Operation setCallback(String name, Callback callback) {
if (callbacks == null) {
callbacks = new HashMap<>();
}
callbacks.put(name, callback);
return this;
}
public Operation removeCallback(String name) {
mapRemove(callbacks, name);
return this;
}
// Deprecated
public Boolean getDeprecated() {
return deprecated;
}
public boolean isDeprecated() {
return Boolean.TRUE.equals(deprecated);
}
public Operation setDeprecated(Boolean deprecated) {
this.deprecated = deprecated;
return this;
}
// SecurityRequirement
public List getSecurityRequirements() {
return securityRequirements;
}
public Operation setSecurityRequirements(List securityRequirements) {
this.securityRequirements = securityRequirements;
return this;
}
public boolean hasSecurityRequirements() {
return securityRequirements != null;
}
public Operation addSecurityRequirement(SecurityRequirement securityRequirement) {
securityRequirements = listAdd(securityRequirements, securityRequirement);
return this;
}
public Operation insertSecurityRequirement(int index, SecurityRequirement securityRequirement) {
securityRequirements = listAdd(securityRequirements, index, securityRequirement);
return this;
}
public Operation removeSecurityRequirement(SecurityRequirement securityRequirement) {
listRemove(securityRequirements, securityRequirement);
return this;
}
// Server
public List getServers() {
return servers;
}
public Operation setServers(List servers) {
this.servers = servers;
return this;
}
public boolean hasServers() {
return servers != null;
}
public Operation addServer(Server server) {
servers = listAdd(servers, server);
return this;
}
public Operation insertServer(int index, Server server) {
servers = listAdd(servers, index, server);
return this;
}
public Operation removeServer(Server server) {
listRemove(servers, server);
return this;
}
@Override
public Operation copy() {
Operation copy = new Operation();
copy.setSummary(getSummary());
copy.setTags(copySimpleList(getTags()));
copy.setDescription(getDescription());
copy.setExternalDocs(copyField(getExternalDocs()));
copy.setOperationId(getOperationId());
copy.setParameters(copyList(getParameters()));
copy.setRequestBody(copyField(getRequestBody()));
copy.setResponses(copyMap(getResponses()));
copy.setCallbacks(copyMap(getCallbacks()));
copy.setDeprecated(getDeprecated());
copy.setSecurityRequirements(copyList(getSecurityRequirements()));
copy.setServers(copyList(getServers()));
copy.setExtensions(copySimpleMap(getExtensions()));
return copy;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy