You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/07/06 17:15:43 UTC

[GitHub] [pulsar] Zhen-hao commented on a change in pull request #11238: [Issue 11007] add a version of AUTO_PRODUCE_BYTES that doesn't validate the message in `encode`

Zhen-hao commented on a change in pull request #11238:
URL: https://github.com/apache/pulsar/pull/11238#discussion_r664740305



##########
File path: pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Schema.java
##########
@@ -426,6 +426,19 @@ default void configureSchemaInfo(String topic, String componentName,
         return DefaultImplementation.newAutoProduceSchema(schema);
     }
 
+    /**
+     * Create a schema instance that accepts a serialized Avro payload
+     * without validating it against the schema specified. 
+     * It can be useful when migrating data from existing event or message stores.
+     *
+     * @return the auto schema instance
+     * @since 2.9.0
+     * @see #AUTO_PRODUCE_BYTES()
+     */
+    static Schema<byte[]> AUTO_PRODUCE_VALIDATED_AVRO_BYTES(Schema<?> schema) {

Review comment:
       my idea was exactly to prevent other schema formats from abusing this feature. 
   the use cases I described already have some external system to guarantee the validity of event data against schemas and the compatibility of schema. 
   I had thought about `AUTO_PRODUCE_BYTES(Schema<?> schema, boolean validate)` but decided that it would give this "dangerous option" to many formats that should never use it. 
   
   I think it is better to add this feature in a case-by-case fashion. 
   




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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