@@ -26882,9 +26882,9 @@ SwaggerUi.partials.signature = (function () {
26882
26882
var items = definition.items;
26883
26883
var xml = definition.xml || {};
26884
26884
26885
- if (!items) { return '' ; }
26885
+ if (!items) { return getErrorMessage() ; }
26886
26886
26887
- value = createXMLSample (name, items, models);
26887
+ value = createSchemaXML (name, items, models);
26888
26888
value += value;
26889
26889
26890
26890
xml = xml || {};
@@ -26901,11 +26901,9 @@ SwaggerUi.partials.signature = (function () {
26901
26901
var model = models[type] || {};
26902
26902
var name = model.name || modelType;
26903
26903
26904
- if (!model.definition) {
26905
- return '';
26906
- }
26904
+ if (!model.definition) { return getErrorMessage(); }
26907
26905
26908
- return createXMLSample (name, model.definition, models);
26906
+ return createSchemaXML (name, model.definition, models);
26909
26907
};
26910
26908
26911
26909
var createPrimitiveXML = function (name, definition) {
@@ -26931,7 +26929,7 @@ SwaggerUi.partials.signature = (function () {
26931
26929
var attributes = [];
26932
26930
var value;
26933
26931
26934
- if (_.keys(primitivesMap).indexOf(type) < 0) { return '' ; }
26932
+ if (_.keys(primitivesMap).indexOf(type) < 0) { return getErrorMessage() ; }
26935
26933
26936
26934
if (namespace) {
26937
26935
attributes.push(namespace);
@@ -26947,7 +26945,7 @@ SwaggerUi.partials.signature = (function () {
26947
26945
};
26948
26946
26949
26947
function createObjectXML (name, definition, models) {
26950
- var props ;
26948
+ var serializedProperties ;
26951
26949
var attrs = [];
26952
26950
var properties = definition.properties;
26953
26951
var additionalProperties = definition.additionalProperties;
@@ -26958,31 +26956,24 @@ SwaggerUi.partials.signature = (function () {
26958
26956
attrs.push(namespace);
26959
26957
}
26960
26958
26961
- if (!properties && !additionalProperties) { return '' ; }
26959
+ if (!properties && !additionalProperties) { return getErrorMessage() ; }
26962
26960
26963
26961
properties = properties || {};
26964
26962
26965
- props = _.map(properties, function (prop, key) {
26966
- return createXMLSample (key, prop, models);
26963
+ serializedProperties = _.map(properties, function (prop, key) {
26964
+ return createSchemaXML (key, prop, models);
26967
26965
}).join('');
26968
26966
26969
26967
if (additionalProperties) {
26970
- props += '<!-- additional elements allowed -->';
26968
+ serializedProperties += '<!-- additional elements allowed -->';
26971
26969
}
26972
26970
26973
- return wrapTag(name, props , attrs);
26971
+ return wrapTag(name, serializedProperties , attrs);
26974
26972
}
26975
26973
26976
- function createXMLSample (name, definition, models) {
26974
+ function createSchemaXML (name, definition, models) {
26977
26975
var type, xml, $ref;
26978
26976
26979
- // allow ingnoring 'name' parameter
26980
- if (arguments.length === 2) {
26981
- models = arguments[1];
26982
- definition = arguments[0];
26983
- name = '';
26984
- }
26985
-
26986
26977
type = definition.type || 'object';
26987
26978
xml = definition.xml || {};
26988
26979
$ref = definition.$ref;
@@ -27002,11 +26993,22 @@ SwaggerUi.partials.signature = (function () {
27002
26993
}
27003
26994
}
27004
26995
26996
+ function getErrorMessage () {
26997
+ return '<!-- invalid XML -->';
26998
+ }
26999
+
27000
+ function createXMLSample (definition, models) {
27001
+ var prolog = '<?xml version="1.0"?>';
27002
+
27003
+ return prolog + createSchemaXML('', definition, models);
27004
+ }
27005
+
27005
27006
return {
27006
27007
getModelSignature: getModelSignature,
27007
27008
createJSONSample: createJSONSample,
27008
27009
getParameterModelSignature: getParameterModelSignature,
27009
27010
createParameterJSONSample: createParameterJSONSample,
27011
+ createSchemaXML: createSchemaXML,
27010
27012
createXMLSample: createXMLSample
27011
27013
};
27012
27014
0 commit comments