use of io.apicurio.datamodels.openapi.models.OasOperation in project apicurio-data-models by Apicurio.
the class DeleteAllOperationsCommand method execute.
/**
* @see io.apicurio.datamodels.cmd.ICommand#execute(io.apicurio.datamodels.core.models.Document)
*/
@Override
public void execute(Document document) {
LoggerCompat.info("[DeleteAllOperationsCommand] Executing.");
this._oldOperations = new ArrayList<>();
OasPathItem parent = (OasPathItem) this._parentPath.resolve(document);
if (this.isNullOrUndefined(parent)) {
return;
}
// Save the old operations (if any)
for (String method : ALL_METHODS) {
OasOperation oldOp = (OasOperation) NodeCompat.getProperty(parent, method);
if (!this.isNullOrUndefined(oldOp)) {
Object oldOpData = JsonCompat.objectNode();
JsonCompat.setPropertyString(oldOpData, "_method", method);
JsonCompat.setProperty(oldOpData, "_operation", Library.writeNode(oldOp));
this._oldOperations.add(oldOpData);
NodeCompat.setProperty(parent, method, null);
}
}
}
use of io.apicurio.datamodels.openapi.models.OasOperation in project apicurio-data-models by Apicurio.
the class NewRequestBodyCommand method undo.
/**
* @see io.apicurio.datamodels.cmd.ICommand#undo(io.apicurio.datamodels.core.models.Document)
*/
@Override
public void undo(Document document) {
LoggerCompat.info("[NewRequestBodyCommand] Reverting.");
if (!this._created) {
return;
}
OasOperation operation = (OasOperation) this._operationPath.resolve(document);
if (this.isNullOrUndefined(operation)) {
return;
}
this.doRemoveRequestBody(operation);
}
use of io.apicurio.datamodels.openapi.models.OasOperation in project apicurio-data-models by Apicurio.
the class OasTraverser method traverseOperation.
/**
* @see io.apicurio.datamodels.core.visitors.Traverser#traverseOperation(io.apicurio.datamodels.core.models.common.Operation)
*/
@Override
protected void traverseOperation(Operation node) {
OasOperation operation = (OasOperation) node;
this.traverseCollection(operation.parameters);
this.traverseIfNotNull(operation.responses);
this.traverseCollection(operation.security);
super.traverseOperation(node);
}
use of io.apicurio.datamodels.openapi.models.OasOperation in project apicurio-data-models by Apicurio.
the class Oas20PathItem method createOperation.
/**
* @see io.apicurio.datamodels.openapi.models.OasPathItem#createOperation(java.lang.String)
*/
@Override
public OasOperation createOperation(String method) {
OasOperation rval = new Oas20Operation(method);
rval._ownerDocument = this.ownerDocument();
rval._parent = this;
return rval;
}
use of io.apicurio.datamodels.openapi.models.OasOperation in project apicurio-data-models by Apicurio.
the class OasParameterUniquenessValidationRule method visitOperation.
/**
* @see io.apicurio.datamodels.combined.visitors.CombinedAllNodeVisitor#visitOperation(io.apicurio.datamodels.core.models.common.Operation)
*/
@Override
public void visitOperation(Operation node) {
OasOperation op = (OasOperation) node;
this.ensureUnique(op.parameters);
}
Aggregations