#1248 createXMLSample added message about additional properties

This commit is contained in:
Anna Bodnia
2016-01-14 20:53:30 +02:00
parent 9543ea4671
commit c1f4814281
3 changed files with 41 additions and 22 deletions

22
dist/swagger-ui.js vendored
View File

@@ -26868,8 +26868,10 @@ SwaggerUi.partials.signature = (function () {
};
};
var createArrayXML = function (name, items, xml, models) {
var createArrayXML = function (name, definition, models) {
var value;
var items = definition.items;
var xml = definition.xml || {};
if (!items) { return ''; }
@@ -26935,16 +26937,19 @@ SwaggerUi.partials.signature = (function () {
return wrapTag(name, value, attributes);
};
function createObjectXML (name, properties, xml, models) {
function createObjectXML (name, definition, models) {
var props;
var attrs = [];
var properties = definition.properties;
var additionalProperties = definition.additionalProperties;
var xml = definition.xml;
var namespace = getNamespace(xml);
if (namespace) {
attrs.push(namespace);
}
if (!properties) { return ''; }
if (!properties && !additionalProperties) { return ''; }
properties = properties || {};
@@ -26952,12 +26957,17 @@ SwaggerUi.partials.signature = (function () {
return createXMLSample(key, prop, models);
}).join('');
return wrapTag(name, props);
if (additionalProperties) {
props += '<!-- additional elements allowed -->';
}
return wrapTag(name, props, attrs);
}
function createXMLSample (name, definition, models) {
var type, xml, $ref;
// allow ingnoring 'name' parameter
if (arguments.length === 2) {
models = arguments[1];
definition = arguments[0];
@@ -26975,9 +26985,9 @@ SwaggerUi.partials.signature = (function () {
name = getName(name, xml);
if (type === 'array') {
return createArrayXML(name, definition.items, xml, models);
return createArrayXML(name, definition, models);
} else if (type === 'object') {
return createObjectXML(name, definition.properties, xml, models);
return createObjectXML(name, definition, models);
} else {
return createPrimitiveXML(name, definition);
}