tadayosi commented on pull request #1850:
URL: https://github.com/apache/camel-k/pull/1850#issuecomment-741696733


   To be clear, the root cause is not whether the prop has a certain default 
value or not, but the way JSON marshalling handles "zero" primitive values when 
"omitempty" is added:
   https://golang.org/pkg/encoding/json/#Marshal
   > The "omitempty" option specifies that the field should be omitted from the 
encoding if the field has an empty value, defined as false, 0, a nil pointer, a 
nil interface value, and any empty array, slice, map, or string.
   
   So theoretically every prop (including `bool` and even `int`) on a trait 
should be declared as a pointer really. In practice, however, in most cases 
`int` props shouldn't have issues so long as assigning `0` to the prop doesn't 
make sense.
   
   Tomorrow I'll follow up with Antonin's suggestion of moving the defaulting 
logic to Configure.


----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to