sijie commented on a change in pull request #2885: Add KeyValueSchema to
satisfy org.apache.kafka.connect.connector.ConnectRecord
URL: https://github.com/apache/pulsar/pull/2885#discussion_r229038224
##########
File path:
pulsar-client-schema/src/main/java/org/apache/pulsar/client/api/Schema.java
##########
@@ -104,6 +105,17 @@ default void validate(byte[] message) {
return JSONSchema.of(clazz);
}
+ /**
+ * Key Value Schema whose underneath schemas are AvroSchema.
+ */
+ static Schema<?> KeyValue(Class key, Class value) {
Review comment:
actually I think it might be better to do following:
- be able to construct keyvalue schema with `SchemaType`
- make the default as JSON, since we are using JSON as default schema for
other places.
```
static <K, V> Schema<KeyValue<K, V>> KeyValue(Class<K> key, Class<V> value,
SchemaType type) {
checkArgument(SchemaType.JSON == type || SchemaType.AVRO == type);
...
}
static <K, V> Schema<KeyValue<K, V>> KeyValue(Class<K> key, Class<V> value) {
return KeyValue(key, value, SchemaType.JSON);
...
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services