use of com.reprezen.swagedit.core.model.ValueNode in project KaiZen-OpenAPI-Editor by RepreZen.
the class Validator method checkMissingRequiredProperties.
/**
* This method checks that the required values for the object type definition contains only valid properties.
*
* @param errors
* @param node
*/
protected void checkMissingRequiredProperties(Set<SwaggerError> errors, AbstractNode node) {
if (node.get("required") instanceof ArrayNode) {
ArrayNode required = node.get("required").asArray();
AbstractNode properties = node.get("properties");
if (properties == null) {
errors.add(error(node, IMarker.SEVERITY_ERROR, Messages.error_missing_properties));
} else {
for (AbstractNode prop : required.elements()) {
if (prop instanceof ValueNode) {
ValueNode valueNode = prop.asValue();
String value = valueNode.getValue().toString();
if (properties.get(value) == null) {
errors.add(error(valueNode, IMarker.SEVERITY_ERROR, String.format(Messages.error_required_properties, value)));
}
}
}
}
}
}
Aggregations