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);
}
}
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;
}
}
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);
}
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;
}
}
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;
}
Aggregations