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 2019/11/07 06:37:15 UTC
[GitHub] [pulsar] merlimat commented on a change in pull request #5557:
[Schema]Add SchemaDisabled for schema
merlimat commented on a change in pull request #5557: [Schema]Add SchemaDisabled for schema
URL: https://github.com/apache/pulsar/pull/5557#discussion_r343494820
##########
File path: pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Schema.java
##########
@@ -213,6 +213,16 @@ default void configureSchemaInfo(String topic, String componentName,
return DefaultImplementation.newProtobufSchema(SchemaDefinition.builder().withPojo(clazz).build());
}
+ /**
+ * Disable SchemaInfo.
+ *
+ * @param schema instance
+ * @return a Schema instance of bytes type
+ */
+ static <T> Schema<T> disabled(Schema<T> schema) {
Review comment:
Using the proposed API of wrapping the schema seems a bit weird to me:
```java
client.newProducer(Schema.disabled(Schema.JSON.of(MyClass.class))
.topic("my-topic")
.create();
```
In Pulsar the schema definition is used in 3 ways:
* Typed client API
* SerDe
* Server side schema validation
Using `disabled` doesn't convey which of these 3 aspect is being disabled.
What about having an option in the producer, like:
```java
client.newProducer(Schema.JSON.of(MyClass.class)
.topic("my-topic")
.schemaDisableValidation(true) // ... or similar
.create();
```
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services