Search in sources :

Example 1 with Oas30Document

use of io.apicurio.datamodels.openapi.v3.models.Oas30Document in project apicurio-data-models by Apicurio.

the class DeleteResponseDefinitionCommand_30 method doRestoreResponseDefinition.

/**
 * @see io.apicurio.datamodels.cmd.commands.DeleteResponseDefinitionCommand#doRestoreResponseDefinition(io.apicurio.datamodels.core.models.Document, java.lang.Object)
 */
@Override
protected void doRestoreResponseDefinition(Document document, Object oldDefinition) {
    Oas30Document doc30 = (Oas30Document) document;
    if (ModelUtils.isDefined(doc30.components)) {
        Oas30ResponseDefinition schemaDef = doc30.components.createResponseDefinition(this._definitionName);
        Library.readNode(oldDefinition, schemaDef);
        doc30.components.addResponseDefinition(this._definitionName, schemaDef);
    }
}
Also used : Oas30Document(io.apicurio.datamodels.openapi.v3.models.Oas30Document) Oas30ResponseDefinition(io.apicurio.datamodels.openapi.v3.models.Oas30ResponseDefinition)

Example 2 with Oas30Document

use of io.apicurio.datamodels.openapi.v3.models.Oas30Document in project apicurio-data-models by Apicurio.

the class NewResponseDefinitionCommand_30 method execute.

/**
 * @see io.apicurio.datamodels.cmd.ICommand#execute(io.apicurio.datamodels.core.models.Document)
 */
@Override
public void execute(Document document) {
    LoggerCompat.info("[NewResponseDefinitionCommand] Executing.");
    Oas30Document doc30 = (Oas30Document) document;
    if (this.isNullOrUndefined(doc30.components)) {
        doc30.components = doc30.createComponents();
        this._nullComponents = true;
    }
    this._nullComponents = false;
    if (this.isNullOrUndefined(doc30.components.getResponseDefinition(this._newDefinitionName))) {
        Oas30ResponseDefinition definition = doc30.components.createResponseDefinition(this._newDefinitionName);
        if (ModelUtils.isDefined(this._newDefinitionDescription)) {
            definition.description = this._newDefinitionDescription;
        }
        doc30.components.addResponseDefinition(this._newDefinitionName, definition);
        this._defExisted = false;
    } else {
        this._defExisted = true;
    }
}
Also used : Oas30Document(io.apicurio.datamodels.openapi.v3.models.Oas30Document) Oas30ResponseDefinition(io.apicurio.datamodels.openapi.v3.models.Oas30ResponseDefinition)

Example 3 with Oas30Document

use of io.apicurio.datamodels.openapi.v3.models.Oas30Document in project apicurio-data-models by Apicurio.

the class AddResponseDefinitionCommand_30 method addDefinition.

/**
 * @see io.apicurio.datamodels.cmd.commands.AddResponseDefinitionCommand#addDefinition(io.apicurio.datamodels.openapi.models.OasDocument, io.apicurio.datamodels.openapi.models.OasResponse)
 */
@Override
protected void addDefinition(OasDocument document, OasResponse definition) {
    Oas30Document doc30 = (Oas30Document) document;
    doc30.components.addResponseDefinition(this._newDefinitionName, (Oas30ResponseDefinition) definition);
}
Also used : Oas30Document(io.apicurio.datamodels.openapi.v3.models.Oas30Document)

Example 4 with Oas30Document

use of io.apicurio.datamodels.openapi.v3.models.Oas30Document in project apicurio-data-models by Apicurio.

the class AddSchemaDefinitionCommand_30 method prepareDocumentForDef.

/**
 * @see io.apicurio.datamodels.cmd.commands.AddSchemaDefinitionCommand#prepareDocumentForDef(io.apicurio.datamodels.openapi.models.OasDocument)
 */
@Override
protected void prepareDocumentForDef(OasDocument document) {
    Oas30Document doc30 = (Oas30Document) document;
    if (this.isNullOrUndefined(doc30.components)) {
        doc30.components = doc30.createComponents();
        this._nullComponents = true;
    } else {
        this._nullComponents = false;
    }
}
Also used : Oas30Document(io.apicurio.datamodels.openapi.v3.models.Oas30Document)

Example 5 with Oas30Document

use of io.apicurio.datamodels.openapi.v3.models.Oas30Document in project apicurio-data-models by Apicurio.

the class ReplaceResponseDefinitionCommand_30 method readNode.

/**
 * @see io.apicurio.datamodels.cmd.commands.ReplaceNodeCommand#readNode(io.apicurio.datamodels.core.models.Document, java.lang.Object)
 */
@Override
protected Oas30ResponseDefinition readNode(Document doc, Object node) {
    Oas30Document doc30 = (Oas30Document) doc;
    Oas30ResponseDefinition definition = doc30.components.createResponseDefinition(this._defName);
    Library.readNode(node, definition);
    return definition;
}
Also used : Oas30Document(io.apicurio.datamodels.openapi.v3.models.Oas30Document) Oas30ResponseDefinition(io.apicurio.datamodels.openapi.v3.models.Oas30ResponseDefinition)

Aggregations

Oas30Document (io.apicurio.datamodels.openapi.v3.models.Oas30Document)84 Test (org.junit.Test)37 OpenApiModelInfo (io.syndesis.server.api.generator.openapi.OpenApiModelInfo)31 Oas30Operation (io.apicurio.datamodels.openapi.v3.models.Oas30Operation)18 Oas30PathItem (io.apicurio.datamodels.openapi.v3.models.Oas30PathItem)17 Oas30Parameter (io.apicurio.datamodels.openapi.v3.models.Oas30Parameter)15 Violation (io.syndesis.common.model.Violation)12 Oas30SecurityScheme (io.apicurio.datamodels.openapi.v3.models.Oas30SecurityScheme)10 Oas30MediaType (io.apicurio.datamodels.openapi.v3.models.Oas30MediaType)8 Server (io.apicurio.datamodels.core.models.common.Server)7 Oas30Response (io.apicurio.datamodels.openapi.v3.models.Oas30Response)7 Oas30Schema (io.apicurio.datamodels.openapi.v3.models.Oas30Schema)7 Oas30SchemaDefinition (io.apicurio.datamodels.openapi.v3.models.Oas30SchemaDefinition)7 Oas30ResponseDefinition (io.apicurio.datamodels.openapi.v3.models.Oas30ResponseDefinition)6 ServerVariable (io.apicurio.datamodels.core.models.common.ServerVariable)5 Oas20Document (io.apicurio.datamodels.openapi.v2.models.Oas20Document)5 Oas30ParameterDefinition (io.apicurio.datamodels.openapi.v3.models.Oas30ParameterDefinition)5 ConnectorSettings (io.syndesis.common.model.connection.ConnectorSettings)5 OasPathItem (io.apicurio.datamodels.openapi.models.OasPathItem)4 Oas30RequestBody (io.apicurio.datamodels.openapi.v3.models.Oas30RequestBody)4