File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
main/java/com/mongodb/kafka/connect/source/schema
test/java/com/mongodb/kafka/connect/source/schema Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ public static Schema fromJson(final String jsonSchema) {
113113
114114 static org .apache .avro .Schema parseSchema (final String jsonSchema ) {
115115 try {
116- return new Parser ().parse (jsonSchema );
116+ return new Parser ().setValidate ( false ). parse (jsonSchema );
117117 } catch (Exception e ) {
118118 throw new ConnectException (format ("Invalid Avro schema. %s\n %s" , e .getMessage (), jsonSchema ));
119119 }
Original file line number Diff line number Diff line change @@ -198,6 +198,27 @@ void testUnsupportedAvroSchema() {
198198 });
199199 }
200200
201+ @ Test
202+ @ DisplayName ("test nested field support" )
203+ void testNestedFieldSupport () {
204+ Schema actual =
205+ AvroSchema .fromJson (
206+ "{\n "
207+ + " \" type\" : \" record\" ,\n "
208+ + " \" name\" : \" keySchema\" ,\n "
209+ + " \" fields\" : [{\" name\" : \" fullDocument.documentKey\" , \" type\" : \" string\" , \" default\" : \" MISSING\" }]\n "
210+ + "}" );
211+
212+ Schema expected =
213+ SchemaBuilder .struct ()
214+ .name ("keySchema" )
215+ .field (
216+ "fullDocument.documentKey" , SchemaBuilder .string ().defaultValue ("MISSING" ).build ())
217+ .build ();
218+
219+ SchemaUtils .assertSchemaEquals (expected , actual );
220+ }
221+
201222 @ Test
202223 @ DisplayName ("test invalid avro schema definitions" )
203224 void testInvalidAvroSchema () {
You can’t perform that action at this time.
0 commit comments