use of io.apicurio.datamodels.openapi.v2.models.Oas20ResponseDefinition 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.Oas20ResponseDefinition in project apicurio-data-models by Apicurio.
the class AddResponseDefinitionCommand_20 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) {
Oas20Document doc20 = (Oas20Document) document;
Oas20ResponseDefinition def20 = (Oas20ResponseDefinition) definition;
doc20.responses.addResponse(this._newDefinitionName, def20);
}
use of io.apicurio.datamodels.openapi.v2.models.Oas20ResponseDefinition 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.Oas20ResponseDefinition in project apicurio-data-models by Apicurio.
the class ReplaceResponseDefinitionCommand_20 method readNode.
/**
* @see io.apicurio.datamodels.cmd.commands.ReplaceNodeCommand#readNode(io.apicurio.datamodels.core.models.Document, java.lang.Object)
*/
@Override
protected Oas20ResponseDefinition readNode(Document doc, Object node) {
Oas20Document doc20 = (Oas20Document) doc;
Oas20ResponseDefinition definition = doc20.responses.createResponse(this._defName);
Library.readNode(node, definition);
return definition;
}
use of io.apicurio.datamodels.openapi.v2.models.Oas20ResponseDefinition in project apicurio-data-models by Apicurio.
the class ReplaceResponseDefinitionCommand_20 method addNode.
/**
* @see io.apicurio.datamodels.cmd.commands.ReplaceNodeCommand#addNode(io.apicurio.datamodels.core.models.Document, io.apicurio.datamodels.core.models.Node)
*/
@Override
protected void addNode(Document doc, Oas20ResponseDefinition node) {
Oas20Document doc20 = (Oas20Document) doc;
node._ownerDocument = doc20;
node._parent = doc20.responses;
doc20.responses.addResponse(node.getName(), node);
}
Aggregations