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

Claus Ibsen commented on CAMEL-24938:
-------------------------------------

Wait till after 4.23.x release

> camel-tooling-model: do not write deprecationNote to the catalog when it is 
> empty
> ---------------------------------------------------------------------------------
>
>                 Key: CAMEL-24938
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24938
>             Project: Camel
>          Issue Type: Improvement
>          Components: tooling
>            Reporter: Claus Ibsen
>            Assignee: shashank
>            Priority: Minor
>
> {{JsonMapper}} writes {{deprecationNote}} for every option whether or not 
> there is one:
> {code:java}
> prop.put("deprecationNote", option.getDeprecationNote());
> {code}
> An option that carries {{@Metadata}} gets the annotation default {{""}}, so 
> the generated JSON holds {{"deprecationNote": ""}} - a field that says 
> something about deprecation, on an option that is not deprecated. An option 
> with no {{@Metadata}} has null and the entry is left out, so whether the 
> field appears has nothing to do with deprecation and everything to do with 
> whether the option happens to be annotated.
> Counted on main:
> * *11125* entries of {{"deprecationNote": ""}} across *803* files under 
> components and core
> * of those, *5352* in *403* component JSONs, about *120 KiB* of catalog that 
> says nothing
> The neighbouring flags already do it the other way - 
> {{supportFileReference}}, {{largeInput}}, {{inputLanguage}}, {{important}} 
> and {{endpointIdentity}} are written only when set, each with the comment 
> "only include if supported to not regen all files". {{deprecationNote}} 
> predates that convention.
> Proposal: write it only when it is not empty, the same way. {{deprecated: 
> false}} stays as it is - that one is a real tri-state that readers use.
> The change is one line in {{JsonMapper.asJsonObject}}, plus a full 
> regeneration: every one of those 11125 entries disappears in one commit. That 
> is a large diff of generated files and no behaviour change - a reader that 
> asks for {{deprecationNote}} gets null instead of an empty string, which the 
> model classes already handle, since that is what an unannotated option does 
> today.
> Found while reviewing https://github.com/apache/camel/pull/26762, where 
> adding {{@Metadata(supportSimpleExpression = true)}} to one option made it 
> grow an empty {{deprecationNote}} - the annotation was blamed, but the 
> convention is the cause.



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

Reply via email to