@Test(expected = InvalidKeyPathException.class) public void nestedFail() throws InvalidKeyPathException { Path path = KeyPathParser.parse("$[\"a\"].b[\"c\"]"); Schema schema = SchemaBuilder .record("X") .fields() .name("a") .type(SchemaBuilder.record("Y").fields().name("b").type(Schema.create(Type.STRING)).noDefault().endRecord()) .noDefault() .endRecord(); try { new KeyPathValidator(path, schema).validate(); } catch (Exception e) { assertThat(e.getMessage(), is("Element '$[\"a\"].b' not a traversable type (found 'STRING'), in path: $[\"a\"].b[\"c\"]")); throw e; } }
public void validate() throws InvalidKeyPathException { List<Element> elements = path.elements(); validateElement(elements, rootSchema, elements.get(0).toString()); }
KeyPathValidator { public void validate() throws InvalidKeyPathException { List<Element> elements = path.elements(); validateElement(elements, rootSchema, elements.get(0).toString()); } }
KeyPathValidator { public void validate() throws InvalidKeyPathException { List<Element> elements = path.elements(); validateElement(elements, rootSchema, elements.get(0).toString()); } KeyPathValidator(Path path, Schema schema); }
KeyPathValidator { public void validate() throws InvalidKeyPathException { List<Element> elements = path.elements(); validateElement(elements, rootSchema, elements.get(0).toString()); } KeyPathValidator(Path path, Schema schema); void validate(); }
KeyPathValidator { public void validate() throws InvalidKeyPathException { List<Element> elements = path.elements(); validateElement(elements, rootSchema, elements.get(0).toString()); } KeyPathValidator(Path path, Schema schema); void validate();  }