@@ -26897,21 +26897,7 @@ SwaggerUi.partials.signature = (function () {
26897
26897
return createXMLSample(name, model.definition, models);
26898
26898
};
26899
26899
26900
- function createObjectXML (name, properties, xml, models) {
26901
- var props;
26902
-
26903
- if (!properties) { return ''; }
26904
-
26905
- properties = properties || {};
26906
-
26907
- props = _.map(properties, function (prop, key) {
26908
- return createXMLSample(key, prop, models);
26909
- }).join('');
26910
-
26911
- return wrapTag(name, props);
26912
- }
26913
-
26914
- function createXMLSample (name, definition, models) {
26900
+ var createPrimitiveXML = function (name, definition) {
26915
26901
var primitivesMap = {
26916
26902
'string': {
26917
26903
'date': new Date(1).toISOString().split('T')[0],
@@ -26928,40 +26914,73 @@ SwaggerUi.partials.signature = (function () {
26928
26914
'default': true
26929
26915
}
26930
26916
};
26931
- var type = definition.type || 'object' ;
26917
+ var type = definition.type;
26932
26918
var format = definition.format;
26933
- var xml = definition.xml || {} ;
26919
+ var namespace = getNamespace( definition.xml) ;
26934
26920
var attributes = [];
26935
- var namespace = getNamespace(xml);
26936
- var $ref = definition.$ref;
26937
26921
var value;
26938
26922
26939
- if (_.isString($ref)) {
26940
- return getModelXML($ref, models);
26923
+ if (_.keys(primitivesMap).indexOf(type) < 0) { return ''; }
26924
+
26925
+ if (namespace) {
26926
+ attributes.push(namespace);
26941
26927
}
26942
26928
26943
- name = getName(name, xml);
26929
+ if (_.isArray(definition.enum)){
26930
+ value = definition.enum[0];
26931
+ } else {
26932
+ value = definition.example || primitivesMap[type][format] || primitivesMap[type].default;
26933
+ }
26934
+
26935
+ return wrapTag(name, value, attributes);
26936
+ };
26937
+
26938
+ function createObjectXML (name, properties, xml, models) {
26939
+ var props;
26940
+ var attrs = [];
26941
+ var namespace = getNamespace(xml);
26944
26942
26945
26943
if (namespace) {
26946
- attributes .push(namespace);
26944
+ attrs .push(namespace);
26947
26945
}
26948
26946
26947
+ if (!properties) { return ''; }
26949
26948
26950
- // Here are going to be else statements for Array and Object types
26951
- if (_.keys(primitivesMap).indexOf(type) !== -1) {
26952
- if (_.isArray(definition.enum)){
26953
- value = definition.enum[0];
26954
- } else {
26955
- value = definition.example || primitivesMap[type][format] || primitivesMap[type].default;
26956
- }
26957
- return wrapTag(name, value, attributes);
26958
- } else if (type === 'array') {
26949
+ properties = properties || {};
26950
+
26951
+ props = _.map(properties, function (prop, key) {
26952
+ return createXMLSample(key, prop, models);
26953
+ }).join('');
26954
+
26955
+ return wrapTag(name, props);
26956
+ }
26957
+
26958
+ function createXMLSample (name, definition, models) {
26959
+ var type, xml, $ref;
26960
+
26961
+ if (arguments.length === 2) {
26962
+ models = arguments[1];
26963
+ definition = arguments[0];
26964
+ name = '';
26965
+ }
26966
+
26967
+ type = definition.type || 'object';
26968
+ xml = definition.xml || {};
26969
+ $ref = definition.$ref;
26970
+
26971
+ if (_.isString($ref)) {
26972
+ return getModelXML($ref, models);
26973
+ }
26974
+
26975
+ name = getName(name, xml);
26976
+
26977
+ if (type === 'array') {
26959
26978
return createArrayXML(name, definition.items, xml, models);
26960
26979
} else if (type === 'object') {
26961
26980
return createObjectXML(name, definition.properties, xml, models);
26981
+ } else {
26982
+ return createPrimitiveXML(name, definition);
26962
26983
}
26963
-
26964
- return '';
26965
26984
}
26966
26985
26967
26986
return {
0 commit comments