@Test public void existingPiiNoChangeIsOk() throws Exception { Schema newSchema = SchemaBuilder .record("r") .fields() .name("f") .prop("sensitivity", "PII") .type(SchemaBuilder.builder().stringType()) .noDefault() .endRecord(); Schema currentSchema = SchemaBuilder .record("r") .fields() .name("f") .prop("sensitivity", "PII") .type(SchemaBuilder.builder().stringType()) .noDefault() .endRecord(); PiiSchemaEvolutionValidator.validate(newSchema, Optional.of(currentSchema)); }
public static void validate(Schema newSchema, Optional<Schema> currentSchema) { currentSchema.ifPresent(current -> { Fields fields = SchemaTraverser.traverse(current, new FieldsVisitor()); SchemaTraverser.traverse(newSchema, new ValidatingVisitor(fields)); }); }
PiiSchemaEvolutionValidator { public static void validate(Schema newSchema, Optional<Schema> currentSchema) { currentSchema.ifPresent(current -> { Fields fields = SchemaTraverser.traverse(current, new FieldsVisitor()); SchemaTraverser.traverse(newSchema, new ValidatingVisitor(fields)); }); } }
PiiSchemaEvolutionValidator { public static void validate(Schema newSchema, Optional<Schema> currentSchema) { currentSchema.ifPresent(current -> { Fields fields = SchemaTraverser.traverse(current, new FieldsVisitor()); SchemaTraverser.traverse(newSchema, new ValidatingVisitor(fields)); }); }  }
PiiSchemaEvolutionValidator { public static void validate(Schema newSchema, Optional<Schema> currentSchema) { currentSchema.ifPresent(current -> { Fields fields = SchemaTraverser.traverse(current, new FieldsVisitor()); SchemaTraverser.traverse(newSchema, new ValidatingVisitor(fields)); }); }  static void validate(Schema newSchema, Optional<Schema> currentSchema); }
PiiSchemaEvolutionValidator { public static void validate(Schema newSchema, Optional<Schema> currentSchema) { currentSchema.ifPresent(current -> { Fields fields = SchemaTraverser.traverse(current, new FieldsVisitor()); SchemaTraverser.traverse(newSchema, new ValidatingVisitor(fields)); }); }  static void validate(Schema newSchema, Optional<Schema> currentSchema);  }