in core/src/main/java/org/apache/rocketmq/schema/registry/core/compatibility/AvroSchemaValidator.java [60:78]
public void validate(SchemaInfo update, SchemaInfo current) {
Schema toValidate = new Schema.Parser().parse(update.getLastRecordIdl());
List<Schema> existingList = new ArrayList<>();
for (String schemaIdl : current.getAllRecordIdlInOrder()) {
Schema existing = new Schema.Parser().parse(schemaIdl);
if (existing.equals(toValidate)) {
throw new SchemaCompatibilityException("The same schemaIdl exists in the previous versions");
}
existingList.add(existing);
}
org.apache.avro.SchemaValidator validator =
SCHEMA_VALIDATOR_CACHE.get(current.getMeta().getCompatibility());
try {
validator.validate(toValidate, existingList);
} catch (SchemaValidationException e) {
throw new SchemaCompatibilityException("Schema compatibility validation failed", e);
}
}