C0urante commented on pull request #10566:
URL: https://github.com/apache/kafka/pull/10566#issuecomment-824292010


   Hmm... I'm wondering if this might break existing setups. Since the 
`SchemaBuilder` class does implement the `Schema` interface, it's currently 
possible to do something like this:
   
   ```java
   import org.apache.kafka.connect.data.Schema;
   import org.apache.kafka.connect.data.SchemaBuilder;
   import org.apache.kafka.connect.data.Struct;
   
   SchemaBuilder builder = SchemaBuilder.struct()
       .field("f1", Schema.BOOLEAN_SCHEMA);
   
   Struct defaultValue = new Struct(builder);
   defaultValue.put("f1", true);
   
   Schema schema = builder.defaultValue(defaultValue).build();
   ```
   
   Since validation currently uses the equality method of the `Struct`'s schema 
(https://github.com/apache/kafka/blob/87b24025cedf08c550a180819b2a5a2dbb75f020/connect/api/src/main/java/org/apache/kafka/connect/data/ConnectSchema.java#L247),
 which in this case is a `SchemaBuilder` instance that doesn't have an 
overridden `equals` method, I think the change proposed here might cause the 
above example to start to fail.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to