use of io.apicurio.datamodels.openapi.v2.models.Oas20ResponseDefinitions in project apicurio-data-models by Apicurio.
the class DeleteResponseDefinitionCommand_20 method doDeleteResponseDefinition.
/**
* @see io.apicurio.datamodels.cmd.commands.DeleteResponseDefinitionCommand#doDeleteResponseDefinition(io.apicurio.datamodels.core.models.Document)
*/
@Override
protected Object doDeleteResponseDefinition(Document document) {
Oas20Document doc20 = (Oas20Document) document;
Oas20ResponseDefinitions responses = doc20.responses;
if (this.isNullOrUndefined(responses) || ModelUtils.isNullOrUndefined(responses.getResponse(this._definitionName))) {
return null;
}
Oas20ResponseDefinition schemaDef = responses.removeResponse(this._definitionName);
return Library.writeNode(schemaDef);
}
use of io.apicurio.datamodels.openapi.v2.models.Oas20ResponseDefinitions in project apicurio-data-models by Apicurio.
the class Oas20DataModelReader method readResponseDefinitions.
/**
* Reads the response definitions.
* @param json
* @param node
*/
public void readResponseDefinitions(Object json, Oas20ResponseDefinitions node) {
List<String> names = JsonCompat.keys(json);
for (String name : names) {
Object definition = JsonCompat.consumeProperty(json, name);
Oas20ResponseDefinition definitionModel = node.createResponse(name);
this.readResponseDefinition(definition, definitionModel);
node.addResponse(name, definitionModel);
}
}
use of io.apicurio.datamodels.openapi.v2.models.Oas20ResponseDefinitions in project apicurio-data-models by Apicurio.
the class DeleteResponseDefinitionCommand_20 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) {
Oas20Document doc20 = (Oas20Document) document;
Oas20ResponseDefinitions responses = doc20.responses;
if (this.isNullOrUndefined(responses)) {
return;
}
Oas20ResponseDefinition definition = doc20.responses.createResponse(this._definitionName);
Library.readNode(oldDefinition, definition);
responses.addResponse(this._definitionName, definition);
}
Aggregations