use of io.apicurio.datamodels.openapi.models.OasDocument in project apicurio-data-models by Apicurio.
the class NewOperationCommand method undo.
/**
* @see io.apicurio.datamodels.cmd.ICommand#undo(io.apicurio.datamodels.core.models.Document)
*/
@Override
public void undo(Document document) {
LoggerCompat.info("[NewOperationCommand] Reverting.");
if (!this._created) {
return;
}
OasDocument odoc = (OasDocument) document;
if (this.isNullOrUndefined(odoc.paths)) {
return;
}
OasPathItem path = odoc.paths.getPathItem(this._path);
if (this.isNullOrUndefined(path)) {
return;
}
NodeCompat.setProperty(path, this._method, null);
}
use of io.apicurio.datamodels.openapi.models.OasDocument in project apicurio-data-models by Apicurio.
the class DeletePathCommand method execute.
/**
* @see io.apicurio.datamodels.cmd.ICommand#execute(io.apicurio.datamodels.core.models.Document)
*/
@Override
public void execute(Document document) {
LoggerCompat.info("[DeletePathCommand] Executing for path: %s", this._path);
OasDocument odoc = (OasDocument) document;
this._oldPath = null;
OasPaths paths = odoc.paths;
if (this.isNullOrUndefined(paths)) {
return;
}
this._oldPath = Library.writeNode(paths.removePathItem(this._path));
}
use of io.apicurio.datamodels.openapi.models.OasDocument in project apicurio-data-models by Apicurio.
the class AddResponseDefinitionCommand method execute.
/**
* @see io.apicurio.datamodels.cmd.ICommand#execute(io.apicurio.datamodels.core.models.Document)
*/
@Override
public void execute(Document document) {
LoggerCompat.info("[AddResponseDefinitionCommand] Executing.");
OasDocument doc = (OasDocument) document;
// Do nothing if the definition already exists.
if (this.defExists(doc)) {
LoggerCompat.info("[AddResponseDefinitionCommand] Definition with name %s already exists.", this._newDefinitionName);
this._defExisted = true;
return;
}
this.prepareDocumentForDef(doc);
OasResponse definition = this.createResponseDefinition(doc);
this.addDefinition(doc, definition);
}
use of io.apicurio.datamodels.openapi.models.OasDocument in project apicurio-data-models by Apicurio.
the class AddSchemaDefinitionCommand method execute.
/**
* @see io.apicurio.datamodels.cmd.ICommand#execute(io.apicurio.datamodels.core.models.Document)
*/
@Override
public void execute(Document document) {
LoggerCompat.info("[AddSchemaDefinitionCommand] Executing.");
OasDocument doc = (OasDocument) document;
// Do nothing if the definition already exists.
if (this.defExists(doc)) {
LoggerCompat.info("[AddSchemaDefinitionCommand] Definition with name %s already exists.", this._newDefinitionName);
this._defExisted = true;
return;
}
this.prepareDocumentForDef(doc);
OasSchema definition = this.createSchemaDefinition(doc);
this.addDefinition(doc, definition);
}
use of io.apicurio.datamodels.openapi.models.OasDocument in project apicurio-data-models by Apicurio.
the class OasTraverser method traverseDocument.
/**
* @see io.apicurio.datamodels.core.visitors.Traverser#traverseDocument(io.apicurio.datamodels.core.models.Document)
*/
@Override
protected void traverseDocument(Document node) {
OasDocument doc = (OasDocument) node;
super.traverseDocument(node);
this.traverseIfNotNull(doc.paths);
this.traverseCollection(doc.security);
}
Aggregations