[NETCONF-588] Restconf Apidoc can't show the Model Schema Created: 15/Dec/18  Updated: 20/May/19  Resolved: 20/May/19

Status: Resolved
Project: netconf
Component/s: restconf-nb
Affects Version/s: Oxygen, Oxygen SR3, Oxygen SR2, Fluorine, Oxygen SR1, Fluorine SR1
Fix Version/s: Fluorine SR3, Neon SR1, Sodium

Type: Bug Priority: Medium
Reporter: sandi wu Assignee: Jakub Morvay
Resolution: Done Votes: 0
Labels: restconf
Remaining Estimate: 1 hour
Time Spent: Not Specified
Original Estimate: 1 hour

Priority: 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.


Generated at Wed Feb 07 20:15:24 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.