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)

This commit is contained in:
Ritesh Garg
2016-12-22 14:00:24 -05:00
parent 2ba1c100ae
commit 8155330ae3

View File

@@ -739,8 +739,14 @@ SwaggerUi.partials.signature = (function () {
var attributes = []; var attributes = [];
if (!items) { return getErrorMessage(); } 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) { if (namespace) {
attributes.push(namespace); attributes.push(namespace);
@@ -841,6 +847,10 @@ SwaggerUi.partials.signature = (function () {
} }
xml = prop.xml || {}; 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); result = createSchemaXML(key, prop, models, config);
if (xml.attribute) { if (xml.attribute) {