use of io.apicurio.datamodels.openapi.v2.models.Oas20Definitions in project apicurio-data-models by Apicurio.
the class DeleteSchemaDefinitionCommand_20 method doRestoreSchemaDefinition.
/**
* @see io.apicurio.datamodels.cmd.commands.DeleteSchemaDefinitionCommand#doRestoreSchemaDefinition(io.apicurio.datamodels.core.models.Document, java.lang.Object)
*/
@Override
protected void doRestoreSchemaDefinition(Document document, Object oldDefinition) {
Oas20Document doc20 = (Oas20Document) document;
Oas20Definitions definitions = doc20.definitions;
if (this.isNullOrUndefined(definitions)) {
return;
}
Oas20SchemaDefinition definition = doc20.definitions.createSchemaDefinition(this._definitionName);
Library.readNode(oldDefinition, definition);
definitions.addDefinition(this._definitionName, definition);
}
use of io.apicurio.datamodels.openapi.v2.models.Oas20Definitions in project apicurio-data-models by Apicurio.
the class DeleteSchemaDefinitionCommand_20 method doDeleteSchemaDefinition.
/**
* @see io.apicurio.datamodels.cmd.commands.DeleteSchemaDefinitionCommand#doDeleteSchemaDefinition(io.apicurio.datamodels.core.models.Document)
*/
@Override
protected Object doDeleteSchemaDefinition(Document document) {
Oas20Document doc20 = (Oas20Document) document;
Oas20Definitions definitions = doc20.definitions;
if (this.isNullOrUndefined(definitions)) {
return null;
}
Oas20SchemaDefinition schemaDef = definitions.removeDefinition(this._definitionName);
return Library.writeNode(schemaDef);
}
use of io.apicurio.datamodels.openapi.v2.models.Oas20Definitions in project apicurio-data-models by Apicurio.
the class Oas20DataModelReader method readDefinitions.
/**
* Reads the definitions.
* @param json
* @param node
*/
public void readDefinitions(Object json, Oas20Definitions node) {
List<String> names = JsonCompat.keys(json);
for (String name : names) {
Object definition = JsonCompat.consumeProperty(json, name);
Oas20SchemaDefinition definitionModel = node.createSchemaDefinition(name);
this.readSchema(definition, definitionModel);
node.addDefinition(name, definitionModel);
}
}
Aggregations