[ 
https://issues.apache.org/jira/browse/AVRO-4332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18104408#comment-18104408
 ] 

Maxim Prygunov commented on AVRO-4332:
--------------------------------------

https://github.com/apache/avro/pull/3822

> IDL writer does not serialize enum default values
> -------------------------------------------------
>
>                 Key: AVRO-4332
>                 URL: https://issues.apache.org/jira/browse/AVRO-4332
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.12.1, 1.13.0, 1.12.2
>            Reporter: Maxim Prygunov
>            Priority: Major
>
> When an Avro Schema of type ENUM has a default value set (via 
> Schema.createEnum(name, doc, namespace, symbols, enumDefault)), the IDL 
> writer in IdlUtils.writeSchema() does not serialize the default value into 
> the IDL output.
> For example, given an enum schema with "default": "ACTIVE":
> 1 Schema enumWithDefault = Schema.createEnum("Status", null, "naming", 
> 2 Arrays.asList("ACTIVE", "INACTIVE"), "ACTIVE");
> Calling IdlUtils.writeIdlProtocol(writer, enumWithDefault) produces:
> 1 enum Status \{ ACTIVE, INACTIVE }
> But the correct IDL representation should be:
> 1 enum Status \{ ACTIVE, INACTIVE } = ACTIVE;
> This means round-tripping (IDL → Schema → IDL) loses the default value 
> information for enums, which can cause downstream issues in code generators 
> and schema validation.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to