Search in sources :

Example 1 with OasOperation

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);
        }
    }
}
Also used : OasOperation(io.apicurio.datamodels.openapi.models.OasOperation) OasPathItem(io.apicurio.datamodels.openapi.models.OasPathItem)

Example 2 with OasOperation

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);
}
Also used : OasOperation(io.apicurio.datamodels.openapi.models.OasOperation)

Example 3 with OasOperation

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);
}
Also used : OasOperation(io.apicurio.datamodels.openapi.models.OasOperation)

Example 4 with OasOperation

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;
}
Also used : OasOperation(io.apicurio.datamodels.openapi.models.OasOperation)

Example 5 with OasOperation

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);
}
Also used : OasOperation(io.apicurio.datamodels.openapi.models.OasOperation)

Aggregations

OasOperation (io.apicurio.datamodels.openapi.models.OasOperation)24 OasPathItem (io.apicurio.datamodels.openapi.models.OasPathItem)13 Map (java.util.Map)8 OasParameter (io.apicurio.datamodels.openapi.models.OasParameter)6 OasResponse (io.apicurio.datamodels.openapi.models.OasResponse)5 Citrus (com.consol.citrus.Citrus)4 CitrusSettings (com.consol.citrus.CitrusSettings)4 TestCaseRunner (com.consol.citrus.TestCaseRunner)4 CitrusAnnotations (com.consol.citrus.annotations.CitrusAnnotations)4 CitrusFramework (com.consol.citrus.annotations.CitrusFramework)4 CitrusResource (com.consol.citrus.annotations.CitrusResource)4 TestContext (com.consol.citrus.context.TestContext)4 OasDocument (io.apicurio.datamodels.openapi.models.OasDocument)4 OasSchema (io.apicurio.datamodels.openapi.models.OasSchema)4 Before (io.cucumber.java.Before)4 Scenario (io.cucumber.java.Scenario)4 And (io.cucumber.java.en.And)4 Given (io.cucumber.java.en.Given)4 Then (io.cucumber.java.en.Then)4 When (io.cucumber.java.en.When)4