in commons/src/main/java/com/epam/eco/schemacatalog/utils/DetailedAvroCompatibilityChecker.java [148:174]
public void testCompatibility(
ParsedSchema newSchema,
List<?> previousSchemas) throws DetailedSchemaValidationException {
Validate.notNull(newSchema, "New Schema is null");
Validate.notNull(previousSchemas, "Collection of Previous Schemas is null");
Schema rawNewSchema = (Schema) newSchema.rawSchema();
if (!previousSchemas.isEmpty()) {
Object o = previousSchemas.get(0);
if (o instanceof ParsedSchema) {
List<Schema> parsedSchemas = previousSchemas.stream()
.map(ps -> (ParsedSchema)ps)
.map(ParsedSchema::rawSchema)
.map(s -> (Schema)s)
.collect(Collectors.toList());
testCompatibility(rawNewSchema, parsedSchemas);
}
if (o instanceof Schema) {
List<Schema> parsedSchemas = previousSchemas.stream()
.map(s -> (Schema)s)
.collect(Collectors.toList());
testCompatibility(rawNewSchema, parsedSchemas);
}
}
}