Skip to content

Commit

Permalink
swagger-api#1248 createXMLSample added message about additional prope…
Browse files Browse the repository at this point in the history
…rties
  • Loading branch information
bodnia committed Jan 14, 2016
1 parent c4e751f commit c5e57a0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
22 changes: 16 additions & 6 deletions swagger-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''; }

Expand Down Expand Up @@ -26935,29 +26937,37 @@ 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 || {};

props = _.map(properties, function (prop, key) {
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];
Expand All @@ -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);
}
Expand Down
Loading

0 comments on commit c5e57a0

Please sign in to comment.