Skip to content

Commit

Permalink
swagger-api#1248 implemented display property as attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
bodnia committed Jan 18, 2016
1 parent 1cc5594 commit 20e8bb3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
27 changes: 21 additions & 6 deletions swagger-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -21089,22 +21089,27 @@ SwaggerUi.partials.signature = (function () {
};
var type = definition.type;
var format = definition.format;
var namespace = getNamespace(definition.xml);
var xml = definition.xml || {};
var namespace = getNamespace(xml);
var attributes = [];
var value;

if (_.keys(primitivesMap).indexOf(type) < 0) { return getErrorMessage(); }

if (namespace) {
attributes.push(namespace);
}

if (_.isArray(definition.enum)){
value = definition.enum[0];
} else {
value = definition.example || primitivesMap[type][format] || primitivesMap[type].default;
}

if (xml.attribute) {
return {name: name, value: value};
}

if (namespace) {
attributes.push(namespace);
}

return wrapTag(name, value, attributes);
};

Expand All @@ -21129,9 +21134,19 @@ SwaggerUi.partials.signature = (function () {
properties = properties || {};

serializedProperties = _.map(properties, function (prop, key) {
var xml, result;

if (isParam && prop.readOnly) { return ''; }

return createSchemaXML(key, prop, models);
xml = prop.xml || {};
result = createSchemaXML(key, prop, models);

if (xml.attribute) {
attrs.push(result);
return '';
}

return result;
}).join('');

if (additionalProperties) {
Expand Down
Loading

0 comments on commit 20e8bb3

Please sign in to comment.