#1248 implemented display property as attribute

This commit is contained in:
Anna Bodnia
2016-01-18 19:53:53 +02:00
parent f07d78de97
commit 8a4c6560f5
4 changed files with 70 additions and 14 deletions

27
dist/swagger-ui.js vendored
View File

@@ -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);
};
@@ -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) {