@Test public void testMissingNullableArrayField() throws Exception { Schema.Parser parser = new Schema.Parser(); Schema schemaOptionalArray = parser.parse("[\"null\", {\"type\": \"array\", \"items\": \"int\"}]"); Schema.Field f4 = sf("field4", schemaOptionalArray); JsonConverter jc = new JsonConverter(sr(f1, f2, f3Rec, f4)); String json = "{\"field1\": 1729, \"field2\": [true, true, false], \"field3\": {\"key\": \"value\"}}"; GenericRecord r = jc.convert(json); String expect = "{\"field1\": 1729, \"field2\": [true, true, false], \"field3\": {\"key\": \"value\"}, \"field4\": null}"; assertEquals(expect, r.toString()); }
@SuppressWarnings("unchecked") public GenericRecord convert(String json) throws IOException { return convert(mapper.readValue(json, Map.class), baseSchema); }
JsonConverter { @SuppressWarnings("unchecked") public GenericRecord convert(String json) throws IOException { return convert(mapper.readValue(json, Map.class), baseSchema); } }
JsonConverter { @SuppressWarnings("unchecked") public GenericRecord convert(String json) throws IOException { return convert(mapper.readValue(json, Map.class), baseSchema); } JsonConverter(Schema schema); }
JsonConverter { @SuppressWarnings("unchecked") public GenericRecord convert(String json) throws IOException { return convert(mapper.readValue(json, Map.class), baseSchema); } JsonConverter(Schema schema); @SuppressWarnings("unchecked") GenericRecord convert(String json); }
JsonConverter { @SuppressWarnings("unchecked") public GenericRecord convert(String json) throws IOException { return convert(mapper.readValue(json, Map.class), baseSchema); } JsonConverter(Schema schema); @SuppressWarnings("unchecked") GenericRecord convert(String json);  }