use of com.spotify.protoman.descriptor.GenericDescriptor in project protoman by spotify.
the class SchemaRegistryService method validationViolationToProto.
private static com.spotify.protoman.ValidationViolation validationViolationToProto(final ValidationViolation violation) {
final com.spotify.protoman.ValidationViolation.Builder violationBuilder = com.spotify.protoman.ValidationViolation.newBuilder().setDescription(violation.description());
@Nullable final GenericDescriptor currentDescriptor = violation.current();
if (currentDescriptor != null) {
currentDescriptor.sourceCodeInfo().ifPresent(sourceCodeInfo -> violationBuilder.setCurrent(sourceCodeInfoToFilePositionProto(sourceCodeInfo)));
}
@Nullable final GenericDescriptor candidateDescriptor = violation.candidate();
if (candidateDescriptor != null) {
candidateDescriptor.sourceCodeInfo().ifPresent(sourceCodeInfo -> violationBuilder.setCandidate(sourceCodeInfoToFilePositionProto(sourceCodeInfo)));
}
return violationBuilder.build();
}
Aggregations