tests #1186 Render primitive types in "Response Class"
This commit is contained in:
6
dist/swagger-ui.js
vendored
6
dist/swagger-ui.js
vendored
@@ -25124,7 +25124,7 @@ SwaggerUi.Views.HeaderView = Backbone.View.extend({
|
||||
|
||||
showPetStore: function(){
|
||||
this.trigger('update-swagger-ui', {
|
||||
url:'http://localhost:3001/order2.json'
|
||||
url:'http://petstore.swagger.io/v2/swagger.json'
|
||||
});
|
||||
},
|
||||
|
||||
@@ -27097,8 +27097,8 @@ SwaggerUi.partials.signature = (function () {
|
||||
|
||||
switch (type) {
|
||||
case 'object': return 'Object is not a primitive';
|
||||
case 'array' : return 'Array[' + items.type + ']';
|
||||
default: return type;
|
||||
case 'array' : return 'Array[' + (items.format || items.type) + ']';
|
||||
default: return schema.format || type;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
4
dist/swagger-ui.min.js
vendored
4
dist/swagger-ui.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -745,8 +745,8 @@ SwaggerUi.partials.signature = (function () {
|
||||
|
||||
switch (type) {
|
||||
case 'object': return 'Object is not a primitive';
|
||||
case 'array' : return 'Array[' + items.type + ']';
|
||||
default: return type;
|
||||
case 'array' : return 'Array[' + (items.format || items.type) + ']';
|
||||
default: return schema.format || type;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -650,4 +650,39 @@ describe('SwaggerUi.partials.signature tests', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('method getPrimitiveSignature', function () {
|
||||
it('returns warning message when type is object', function () {
|
||||
expect(sut.getPrimitiveSignature({type: 'object'})).to.equal('Object is not a primitive');
|
||||
});
|
||||
|
||||
it('returns array with items.format when passing array', function () {
|
||||
var schema = {
|
||||
type: 'array',
|
||||
items: {
|
||||
format: 'format',
|
||||
type: 'type'
|
||||
}
|
||||
};
|
||||
expect(sut.getPrimitiveSignature(schema)).to.equal('Array[format]');
|
||||
});
|
||||
|
||||
it('returns array with items.type when passing array without items.format', function () {
|
||||
var schema = {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'type'
|
||||
}
|
||||
};
|
||||
expect(sut.getPrimitiveSignature(schema)).to.equal('Array[type]');
|
||||
});
|
||||
|
||||
it('returns format of primitive', function () {
|
||||
expect(sut.getPrimitiveSignature({type: 'type', format: 'format'})).to.equal('format');
|
||||
});
|
||||
|
||||
it('returns type of primitive if format is not passed', function () {
|
||||
expect(sut.getPrimitiveSignature({type: 'type'})).to.equal('type');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user