Uploaded image for project: 'netconf'
  1. netconf
  2. NETCONF-588

Restconf Apidoc can't show the Model Schema

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Medium
    • Resolution: Done
    • Oxygen, Oxygen SR3, Oxygen SR2, Fluorine, Oxygen SR1, Fluorine SR1
    • Fluorine SR3, Neon SR1, Sodium
    • restconf-nb
    • High

    Description

              In oxygen and newer version, the class org.opendaylight.netconf.sal.rest.doc.jaxrs.ApidocApplication is changed to use a GsonProvider as MessageBodyWriter
      for swagger api object, such as ApiDelaration and ResourceList and so on.
              GsonProvider uses com.google.gson.Gson to convert a JavaBean to a json string and is not compatitble with
      the ApiDelaration which has a defined field, com.fasterxml.jackson.databind.node.ObjectNode models for the swagger model object.
             The problem is that the ObjectNode is a concept in fasterxml not in Gson.  com.google.gson.Gson can't correctly convert com.fasterxml.jackson.databind.node.ObjectNode,
      because the converted result contains "_children" which does not belong to a JavaBean.
      The Correct result converted by com.fasterxml.jackson.databind.ObjectMapper:

      "models": {
      "unique_empty_identifier": {},
      "(config)general-entity_modulePOST": {
      "$schema": "http://json-schema.org/draft-04/schema",
      "type": "object",
      "id": "(config)general-entity_modulePOST",
      "properties": {
      "entity": {
      "type": "array",
      "items":
      
      {
      "$ref": "general-entity(config)entity"
      }
      
      }
      }
      },
      Incorrect result converted by com.google.gson.Gson: "models": {
      "_children": {
      "unique_empty_identifier": {
      "_children": {},
      "_nodeFactory":
      
      {
      "_cfgBigDecimalExact": false
      }
      
      },
      "(config)general-entity_modulePOST": {
      "_children": {
      "$schema":
      
      {
      "_value": "http://json-schema.org/draft-04/schema"
      }
      ,
      "type":
      
      {
      "_value": "object"
      }
      
      ,
      "id":
      
      {
      "_value": "(config)general-entity_modulePOST"
      }
      
      ,
      "properties": {
      "_children": {
      "entity": {
      "_children": {
      "type":
      
      {
      "_value": "array"
      }
      
      ,
      "items": {
      "_children": {
      "$ref":
      
      {
      "_value": "general-entity(config)entity"
      }
      
      },
      "_nodeFactory":
      
      {
      "_cfgBigDecimalExact": false
      }
      
      }
      },
      "_nodeFactory":
      
      {
      "_cfgBigDecimalExact": false
      }
      
      }
      },
      "_nodeFactory":
      
      {
      "_cfgBigDecimalExact": false
      }
      
      }
      },
      "_nodeFactory":
      {
      "_cfgBigDecimalExact": false
      }
      
      },

      So, the com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider class should be used to serialize an instance of ApidocApplication. The GsonProvider class can't be used for ApidocApplication.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            JMorvay Jakub Morvay
            wusandi sandi wu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1 hour
                1h
                Remaining:
                Remaining Estimate - 1 hour
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified