From 8155330ae32105edf73ab5eb763770bfca6c6375 Mon Sep 17 00:00:00 2001 From: Ritesh Garg Date: Thu, 22 Dec 2016 14:00:24 -0500 Subject: [PATCH] Change to set name for array elements from items.xml.name if it is set. Another issue after fixing this was for complex objects, that the name for element (from xmlelement annotation) was getting overridden by ref name (from xmlelementwrapper annotation) --- src/main/javascript/view/partials/signature.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/javascript/view/partials/signature.js b/src/main/javascript/view/partials/signature.js index c6ed5fab..97ed4b06 100644 --- a/src/main/javascript/view/partials/signature.js +++ b/src/main/javascript/view/partials/signature.js @@ -739,8 +739,14 @@ SwaggerUi.partials.signature = (function () { var attributes = []; if (!items) { return getErrorMessage(); } + + // To provide the name for the items from xml.name if it is provided | https://github.com/swagger-api/swagger-core/issues/2047 + var key = name; + if(items.xml != null && items.xml.name != null) { + key = items.xml.name; + } - value = createSchemaXML(name, items, models, config); + value = createSchemaXML(key, items, models, config); if (namespace) { attributes.push(namespace); @@ -841,6 +847,10 @@ SwaggerUi.partials.signature = (function () { } xml = prop.xml || {}; + // To provide the name for the object from xml.name if it is provided. If it is not, then it would be derived from the ref | https://github.com/swagger-api/swagger-core/issues/2047 + if(xml != null && xml.name != null) { + key = xml.name; + } result = createSchemaXML(key, prop, models, config); if (xml.attribute) {