moonboots300 commented on issue #4271: Pulsar Avro Schema Enum improvement 
request
URL: https://github.com/apache/pulsar/issues/4271#issuecomment-492797526
 
 
   @codelipenghui, @merlimat  - That is another problem that I would like to 
highlight. Suppose I have a schema that we are currently using that has the 
following Avro Enum field:
   ```
   {
       "name": "exampleEnum",
        "type": ["null", {
                "type": "enum",
                "name": "ExampleEnum",
                "symbols": ["YES", "NO"]
                }
        ]
   }
   ```
   If I do AvroSchema.of( <Classname of Pojo> ). I get the following Enum field 
in my definition (which is not backwards compatible - with the **,"default": 
Null** added at the end): 
   
   ```
   {
       "name": "exampleEnum",
        "type": ["null", {
                "type": "enum",
                "name": "ExampleEnum",
                "symbols": ["YES", "NO"]
                }
        ],
        "default": null
   }
   ```
   The use case I have for this one is that I am trying to implement a current 
production Use Case with Pulsar Functions - 1. I use AvroSchema.of() to 
generate the schema and 2. I use schema.encode(OBJECT) to Serialize before 
publishing to a pulsar topic.
   
   If I use the avro-tools jar, following the directions here along with the 
Avro java library and I can Serialize / Deserialize messages With the Schema 
definition text file and my POJO that was generated from avro-tools jar. Using 
this workaround along with Pulsar Functions works but it is not utilizing the 
schema.encode() and AvroSchema.of() which is how we should be using Avro 
Schema's with Pulsar.
   

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


With regards,
Apache Git Services

Reply via email to