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

ASF GitHub Bot commented on NIFI-3343:
--------------------------------------

Github user mcgilman commented on the issue:

    https://github.com/apache/nifi/pull/1414
  
    @jdye64 The client dto package was designed to be simple POJOs and with no 
dependencies to make it easy to consume for any clients of the REST API. 
Unfortunately, along the way we ended up adding a dependency on the 
documentation library (swagger).
    
    This proposed change will add another dependency on a serialization library 
that the client may or may not be using. We have left all serialization logic 
to be specified via JAXB annotations to try to remain agnostic to whatever 
serialization or REST library the client is using.
    
    In you happen to be using Jackson, things should (de)serialize correctly by 
just setting the (de)serializationConfig to use the JAXB annotation 
introspector. Here's an example from the NiFi codebase [1].
    
    [1] 
https://github.com/apache/nifi/blob/master/nifi-commons/nifi-web-utils/src/main/java/org/apache/nifi/web/util/ObjectMapperResolver.java


> Annotate @XmlJavaTypeAdapter(DateTimeAdapter.class) fields in client dto with 
> JsonFormat
> ----------------------------------------------------------------------------------------
>
>                 Key: NIFI-3343
>                 URL: https://issues.apache.org/jira/browse/NIFI-3343
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework
>    Affects Versions: 1.1.1
>            Reporter: Jeremy Dyer
>            Assignee: Jeremy Dyer
>             Fix For: 1.2.0
>
>
> Currently when implementing a client to consume NiFi client dto serialized 
> objects Jackson is unable to deserialize 
> @XmlJavaTypeAdapter(DateTimeAdapter.class) to a Java Date object since the 
> format is unknown. Simply setting the default ObjectMapper default date using 
> something like ...
> DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss Z");
> this.mapper.setDateFormat(dateFormat);
> Will not work because there are portions that do have dates in this format. 
> The only options seems to making the end users write their own custom date 
> deserializers =( or annotating the dto object fields with @JsonFormat so that 
> it is handled for them automatically.
> I plan to annotate the fields because that seems most efficient for everyone.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to