[ 
https://issues.apache.org/jira/browse/AIRAVATA-3328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Marcus Christie updated AIRAVATA-3328:
--------------------------------------
    Description: 
Thrift required fields can have a default value. This value is present in the 
generated models, but it is only serialized if the field has actually been set. 
The semantics on required fields with default values seems a little confusing.

This causes an issue with Dozer since it has logic to only copy fields when 
they differ. A field on an entity will only copy to a Thrift data model field 
when they have the same value. If the field on the entity has the default value 
of the Thrift field, then it won't copy and that field will not get serialized. 
This then causes a validation error in Thrift since the required field wasn't 
set.

This problem was initially discoverred in AIRAVATA-3268, see [this 
comment|https://issues.apache.org/jira/browse/AIRAVATA-3268?focusedCommentId=16978768&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16978768]
 and following.

I think, as noted in [this 
comment|https://issues.apache.org/jira/browse/AIRAVATA-3268?focusedCommentId=16979609&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16979609],
 that we can create a [Dozer Custom Bean 
Factory|https://dozermapper.github.io/gitbook/documentation/custombeanfactories.html]
 to fix this.



  was:
Thrift required fields can have a default value. This value is present in the 
generated models, but it is only serialized if the field has actually been set. 
The semantics on required fields with default values seems a little confusing.

This causes an issue with Dozer since it has logic to only copy fields when 
they differ. A field on an entity will only copy to a Thrift data model field 
when they have the same value. If the field on the entity has the default value 
of the Thrift field, then it won't copy and that field will not get serialized. 
This then causes a validation error in Thrift since the required field wasn't 
set.

This problem was initially discoverred in AIRAVATA-3268, see [this 
comment](https://issues.apache.org/jira/browse/AIRAVATA-3268?focusedCommentId=16978768&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16978768)
 and following.

I think, as noted in [this 
comment](https://issues.apache.org/jira/browse/AIRAVATA-3268?focusedCommentId=16979609&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16979609),
 that we can create a [Dozer Custom Bean 
Factory](https://dozermapper.github.io/gitbook/documentation/custombeanfactories.html)
 to fix this.



> Fix Thrift/Dozer incompatibilty in Java 11
> ------------------------------------------
>
>                 Key: AIRAVATA-3328
>                 URL: https://issues.apache.org/jira/browse/AIRAVATA-3328
>             Project: Airavata
>          Issue Type: New Feature
>          Components: Registry API
>            Reporter: Marcus Christie
>            Assignee: Marcus Christie
>            Priority: Major
>
> Thrift required fields can have a default value. This value is present in the 
> generated models, but it is only serialized if the field has actually been 
> set. The semantics on required fields with default values seems a little 
> confusing.
> This causes an issue with Dozer since it has logic to only copy fields when 
> they differ. A field on an entity will only copy to a Thrift data model field 
> when they have the same value. If the field on the entity has the default 
> value of the Thrift field, then it won't copy and that field will not get 
> serialized. This then causes a validation error in Thrift since the required 
> field wasn't set.
> This problem was initially discoverred in AIRAVATA-3268, see [this 
> comment|https://issues.apache.org/jira/browse/AIRAVATA-3268?focusedCommentId=16978768&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16978768]
>  and following.
> I think, as noted in [this 
> comment|https://issues.apache.org/jira/browse/AIRAVATA-3268?focusedCommentId=16979609&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16979609],
>  that we can create a [Dozer Custom Bean 
> Factory|https://dozermapper.github.io/gitbook/documentation/custombeanfactories.html]
>  to fix this.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to