use of org.eclipse.core.resources.IMarker.SEVERITY_ERROR in project KaiZen-OpenAPI-Editor by RepreZen.
the class OpenApi3Validator method validate.
@Override
public Set<SwaggerError> validate(JsonDocument document, URI baseURI) {
final Set<SwaggerError> errors = super.validate(document, baseURI);
final long nbOfErrors = errors.stream().filter(e -> e.getLevel() == SEVERITY_ERROR).count();
// and option in UI is enable.
if (isAdvancedValidation() && nbOfErrors == 0) {
try {
OpenApi3 result = new OpenApi3Parser().parse(document.get(), baseURI.toURL(), true);
for (ValidationItem item : result.getValidationResults().getItems()) {
PositionInfo pos = item.getPositionInfo();
int line = pos != null ? pos.getLine() : 1;
errors.add(new SwaggerError(line, getSeverity(item.getSeverity()), item.getMsg()));
}
} catch (Exception e) {
Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage()));
}
}
return errors;
}
Aggregations