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

Kevin Doran updated NIFIREG-248:
--------------------------------
    Description: 
If using a swagger-codgen client with strict DTO json deserialization (fail on 
unknown fields), the following types of exceptions occur when retrieving any 
DTO that has a {{Link}} type field:
{code:java}
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized 
field "href" (class com.example.swagger.client.model.Link), not marked as 
ignorable (7 known properties: "params", "title", "rel", "type", "uri", 
"uriBuilder", "rels"])
 at [Source: 
[\{"createdTimestamp":1553517081543,"identifier":"8d27c763-26ce-4f0b-bc5d-56382bd17e15","link":{"href":"buckets/8d27c763-26ce-4f0b-bc5d-56382bd17e15","params":({"rel":"self"}},"name":"test_bucket","permissions":\{"canDelete":true,"canRead":true,"canWrite":true}}];
 line: 1, column: 104] (through reference chain: 
java.util.ArrayList[0]->com.example.swagger.client.model.Bucket["link"]->com.example.swagger.client.model.Link["href"])
{code}
The swagger client DTO's were generated based on the swagger.json definition 
from the build output.

The root cause is that the {{Link}} type is an abstract class that has 
different fields from the concrete classes that typically get serialized. For 
example, {{Link}} does not have an {{href}} field which is included in the 
JSON. It also has some fields that are not included in the JSON such as 
{{UriBuilder}}.

Currently the work around is permitting non existing properties for Jackson, 
although that does not create the needed href field in the response object, it 
simply avoids the runtime exception.

  was:
If using a swagger-codgen client with strict DTO json deserialization (fail on 
unknown fields), the following types of exceptions occur when retrieving any 
DTO that has a {{Link}} type field:
{code:java}
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized 
field "href" (class com.example.swagger.client.model.Link), not marked as 
ignorable (7 known properties: "params", "title", "rel", "type", "uri", 
"uriBuilder", "rels"])
 at [Source: 
[\{"createdTimestamp":1553517081543,"identifier":"8d27c763-26ce-4f0b-bc5d-56382bd17e15","link":{"href":"buckets/8d27c763-26ce-4f0b-bc5d-56382bd17e15","params":({"rel":"self"}},"name":"test_bucket","permissions":\{"canDelete":true,"canRead":true,"canWrite":true}}];
 line: 1, column: 104] (through reference chain: 
java.util.ArrayList[0]->com.example.swagger.client.model.Bucket["link"]->com.example.swagger.client.model.Link["href"])
{code}
The swagger client DTO's were generated based on the swagger.json definition 
from the build output.

The root cause is that the {{Link}} type is an abstract class that has 
different fields from the concrete classes that typically get serialized. For 
example, {{Link}} does not have an {{href}} field which is included in the 
JSON. It also has some fields that are not included in the JSON such as 
{{UriBuilder}}.

Currently the work is permitting non existing properties for Jackson.


> Inconsistency between Swagger Link Model and actual response 
> -------------------------------------------------------------
>
>                 Key: NIFIREG-248
>                 URL: https://issues.apache.org/jira/browse/NIFIREG-248
>             Project: NiFi Registry
>          Issue Type: Bug
>    Affects Versions: 0.1.0, 0.2.0, 0.3.0
>            Reporter: Kevin Doran
>            Priority: Minor
>
> If using a swagger-codgen client with strict DTO json deserialization (fail 
> on unknown fields), the following types of exceptions occur when retrieving 
> any DTO that has a {{Link}} type field:
> {code:java}
> com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: 
> Unrecognized field "href" (class com.example.swagger.client.model.Link), not 
> marked as ignorable (7 known properties: "params", "title", "rel", "type", 
> "uri", "uriBuilder", "rels"])
>  at [Source: 
> [\{"createdTimestamp":1553517081543,"identifier":"8d27c763-26ce-4f0b-bc5d-56382bd17e15","link":{"href":"buckets/8d27c763-26ce-4f0b-bc5d-56382bd17e15","params":({"rel":"self"}},"name":"test_bucket","permissions":\{"canDelete":true,"canRead":true,"canWrite":true}}];
>  line: 1, column: 104] (through reference chain: 
> java.util.ArrayList[0]->com.example.swagger.client.model.Bucket["link"]->com.example.swagger.client.model.Link["href"])
> {code}
> The swagger client DTO's were generated based on the swagger.json definition 
> from the build output.
> The root cause is that the {{Link}} type is an abstract class that has 
> different fields from the concrete classes that typically get serialized. For 
> example, {{Link}} does not have an {{href}} field which is included in the 
> JSON. It also has some fields that are not included in the JSON such as 
> {{UriBuilder}}.
> Currently the work around is permitting non existing properties for Jackson, 
> although that does not create the needed href field in the response object, 
> it simply avoids the runtime exception.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to