@Test
public void unionAllBranchesOk() throws InvalidKeyPathException {

  Path path = KeyPathParser.parse("$[\"a\"][\"c\"]");
  Schema schema = SchemaBuilder
      .record("X")
      .fields()
      .name("a")
      .type(SchemaBuilder
          .unionOf()
          .type(SchemaBuilder.record("Z").fields().name("c").type(Schema.create(Type.STRING)).noDefault().endRecord())
          .and()
          .type(SchemaBuilder.record("K").fields().name("c").type(Schema.create(Type.INT)).noDefault().endRecord())
          .endUnion())
      .noDefault()
      .endRecord();
  new KeyPathValidator(path, schema).validate();
}