-
Improvement
-
Resolution: Done
-
Medium
-
None
Inside the Components/Schema objects, there are unnecessary "xml" elements present in the property nodes. While this element is required for JSON/XML conversion, it is not necessary within the "properties" elements. This results in the generation of numerous unnecessary XML namespaces.
For example, ODL response with XML :
<toaster xmlns="http://netconfcentral.org/ns/toaster2">
<toasterModelNumber>Some toasterModelNumber</toasterModelNumber>
<darknessFactor>1000</darknessFactor>
<toasterManufacturer>Some toasterManufacturer</toasterManufacturer>
<toasterSlot>
<slotId>Some slotId</slotId>
</toasterSlot>
<toasterStatus>up</toasterStatus>
</toaster>
OpenAPI example for same GET response:
<?xml version="1.0" encoding="UTF-8"?> <toaster xmlns="http://netconfcentral.org/ns/toaster2"> <toasterManufacturer xmlns="http://netconfcentral.org/ns/toaster2">Some toasterManufacturer</toasterManufacturer> <toasterSlot xmlns="http://netconfcentral.org/ns/toaster2"> <slotId xmlns="http://netconfcentral.org/ns/toaster2">Some slotId</slotId> </toasterSlot> <toasterModelNumber xmlns="http://netconfcentral.org/ns/toaster2">Some toasterModelNumber</toasterModelNumber> <toasterStatus xmlns="http://netconfcentral.org/ns/toaster2">up</toasterStatus> <darknessFactor xmlns="http://netconfcentral.org/ns/toaster2">1000</darknessFactor> </toaster>
By removing these unnecessary XML elements, we can save memory space in the Heap.
Current state for `toaster2_config_toaster` element:
"toaster2_config_toaster": { "properties": { "toasterManufacturer": { "description": "The name of the toaster's manufacturer. For instance,\n Microsoft Toaster.", "minLength": 0, "maxLength": 255, "default": "Some toasterManufacturer", "type": "string", "xml": { "name": "toasterManufacturer", "namespace": "http://netconfcentral.org/ns/toaster2" } }, "toasterSlot": { "type": "array", "items": { "$ref": "#/components/schemas/toaster2_toaster_config_toasterSlot" }, "description": "" }, "toasterModelNumber": { "description": "The name of the toaster's model. For instance,\n Radiant Automatic.", "minLength": 0, "maxLength": 255, "default": "Some toasterModelNumber", "type": "string", "xml": { "name": "toasterModelNumber", "namespace": "http://netconfcentral.org/ns/toaster2" } }, "toasterStatus": { "description": "This variable indicates the current state of\n the toaster.", "enum": [ "up", "down" ], "default": "up", "type": "string", "xml": { "name": "toasterStatus", "namespace": "http://netconfcentral.org/ns/toaster2" } }, "darknessFactor": { "description": "The darkness factor. Basically, the number of ms to multiple the doneness value by.", "format": "int64", "default": 1000, "type": "integer", "xml": { "name": "darknessFactor", "namespace": "http://netconfcentral.org/ns/toaster2" } } }, "type": "object", "title": "toaster2_config_toaster", "description": "Top-level container for all toaster database objects.", "xml": { "name": "toaster", "namespace": "http://netconfcentral.org/ns/toaster2" } }
Expected:
"toaster2_config_toaster": { "properties": { "toasterManufacturer": { "description": "The name of the toaster's manufacturer. For instance,\n Microsoft Toaster.", "minLength": 0, "maxLength": 255, "default": "Some toasterManufacturer", "type": "string" }, "toasterSlot": { "type": "array", "items": { "$ref": "#/components/schemas/toaster2_toaster_config_toasterSlot" }, "description": "" }, "toasterModelNumber": { "description": "The name of the toaster's model. For instance,\n Radiant Automatic.", "minLength": 0, "maxLength": 255, "default": "Some toasterModelNumber", "type": "string" }, "toasterStatus": { "description": "This variable indicates the current state of\n the toaster.", "enum": [ "up", "down" ], "default": "up", "type": "string" }, "darknessFactor": { "description": "The darkness factor. Basically, the number of ms to multiple the doneness value by.", "format": "int64", "default": 1000, "type": "integer" } }, "type": "object", "title": "toaster2_config_toaster", "description": "Top-level container for all toaster database objects.", "xml": { "name": "toaster", "namespace": "http://netconfcentral.org/ns/toaster2" } }
- relates to
-
NETCONF-938 Cannot generate API docs for Junos device
- Resolved