use of io.apicurio.datamodels.openapi.models.OasResponse in project apicurio-data-models by Apicurio.
the class DeleteResponseCommand method undo.
/**
* @see io.apicurio.datamodels.cmd.ICommand#undo(io.apicurio.datamodels.core.models.Document)
*/
@Override
public void undo(Document document) {
LoggerCompat.info("[DeleteResponseCommand] Reverting.");
if (this.isNullOrUndefined(this._oldResponse)) {
return;
}
OasResponses responses = (OasResponses) this._responsesPath.resolve(document);
if (this.isNullOrUndefined(responses)) {
return;
}
OasResponse response = responses.createResponse(this._responseCode);
Library.readNode(this._oldResponse, response);
if (this.isNullOrUndefined(this._responseCode)) {
responses.default_ = response;
} else {
responses.addResponse(this._responseCode, response);
}
}
use of io.apicurio.datamodels.openapi.models.OasResponse 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.OasResponse in project apicurio-data-models by Apicurio.
the class Oas30Responses method createResponse.
/**
* @see io.apicurio.datamodels.openapi.models.OasResponses#createResponse(java.lang.String)
*/
@Override
public OasResponse createResponse(String statusCode) {
OasResponse response = new Oas30Response(statusCode);
response._ownerDocument = this.ownerDocument();
response._parent = this;
return response;
}
use of io.apicurio.datamodels.openapi.models.OasResponse in project apicurio-data-models by Apicurio.
the class Oas20Responses method createResponse.
/**
* @see io.apicurio.datamodels.openapi.models.OasResponses#createResponse(java.lang.String)
*/
@Override
public OasResponse createResponse(String statusCode) {
OasResponse response = new Oas20Response(statusCode);
response._ownerDocument = this.ownerDocument();
response._parent = this;
return response;
}
use of io.apicurio.datamodels.openapi.models.OasResponse in project apicurio-data-models by Apicurio.
the class OasDataModelWriter method visitResponseDefinition.
/**
* @see io.apicurio.datamodels.openapi.visitors.IOasVisitor#visitResponseDefinition(io.apicurio.datamodels.core.models.common.IDefinition)
*/
@Override
public void visitResponseDefinition(IDefinition node) {
OasResponse response = (OasResponse) node;
Object parent = this.lookupParentJson(response);
Object json = JsonCompat.objectNode();
writeResponse(json, response);
this.writeExtraProperties(json, response);
addResponseDefinitionToParent(parent, json, node);
this.updateIndex(response, json);
}
Aggregations