Uploaded image for project: 'NiFi Registry - MOVED TO NIFI PROJECT'
  1. NiFi Registry - MOVED TO NIFI PROJECT
  2. NIFIREG-248

Inconsistency between Swagger Link Model and actual response

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.1.0, 0.2.0, 0.3.0
    • Fix Version/s: 0.4.0
    • Component/s: None
    • Labels:
      None

      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:

      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"])
      

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bbende Bryan Bende
                Reporter:
                kdoran Kevin Doran
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h