frank-montyne opened a new issue #10104:
URL: https://github.com/apache/pulsar/issues/10104


   **Is your enhancement request related to a problem? Please describe.**
   In our projects we are using Gson not Jackson for Json 
serialization/deserialization. On top of that we make use of immutables 
(immutables.org) to define our data objects. Getters and setters are of the 
form field(), field(type data) not getField(), setField(...). When passing 
these data classes to JSONSchema.of() the fields are not recognized and we end 
up with null data in the topic when sending messages using a producer. 
   Another problem is that in some cases we use json adapters to create a json 
representation that is different from how the fields are represented in the 
data class.  
   At this point it is not possible to set your own JSON schema and pass the 
JSON string representation instead of the data object. 
   The SchemaBuilder does not seem to support schema's of type "JSON" .
   I tried passing a schema that was created by the JSONSchema class using 
   String json = JSONSchema.of(Data.class).getSchemaInfo().toString() and then 
passing the resulting string to 
   SchemaDefinition.builder().withJsonDef(json).build() 
   This produces org.apache.avro.SchemaParseException: Type not supported: 
JSON) 
   
   **Describe the solution you'd like**
   Support of JSON schema's in the SchemaDefinition builder. Some documentation 
on JSON schema's would also be nice.
   Support for passing the json representation (string) instead of a POJO. 
   Direct support for Gson and immutables would be nice.
   It would also be nice to be able to specify a limited set of fields to be 
stored. The json representation of the data object should then be stored as a 
separate string field.
   
   **Describe alternatives you've considered**
   Switching to Jackson is not an option. Our whole code base is based on Gson 
for Json related stuff.
   Creating mirror classes to convert our immutables to plain and simple POJO's 
but that's way too much work and a maintenance nightmare.
   
   **Additional context**
   Using version 2.7.1


-- 
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:
[email protected]


Reply via email to