don't override title and type if they are already defined

This commit is contained in:
Laurent Lepinay
2015-10-05 13:36:52 +02:00
parent 50a9fc8d79
commit c269dbd9ed
3 changed files with 13 additions and 5 deletions

4
dist/swagger-ui.js vendored
View File

@@ -31451,13 +31451,17 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
$.extend(true, param.schema, this.model.definitions[param.type]); $.extend(true, param.schema, this.model.definitions[param.type]);
param.schema.definitions = this.model.definitions; param.schema.definitions = this.model.definitions;
// This is required for JsonEditor to display the root properly // This is required for JsonEditor to display the root properly
if(!param.schema.type){
param.schema.type = 'object'; param.schema.type = 'object';
}
// This is the title that will be used by JsonEditor for the root // This is the title that will be used by JsonEditor for the root
// Since we already display the parameter's name in the Parameter column // Since we already display the parameter's name in the Parameter column
// We set this to space, we can't set it to null or space otherwise JsonEditor // We set this to space, we can't set it to null or space otherwise JsonEditor
// will replace it with the text "root" which won't look good on screen // will replace it with the text "root" which won't look good on screen
if(!param.schema.title){
param.schema.title = ' '; param.schema.title = ' ';
} }
}
var paramView = new SwaggerUi.Views.ParameterView({ var paramView = new SwaggerUi.Views.ParameterView({

File diff suppressed because one or more lines are too long

View File

@@ -245,13 +245,17 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
$.extend(true, param.schema, this.model.definitions[param.type]); $.extend(true, param.schema, this.model.definitions[param.type]);
param.schema.definitions = this.model.definitions; param.schema.definitions = this.model.definitions;
// This is required for JsonEditor to display the root properly // This is required for JsonEditor to display the root properly
if(!param.schema.type){
param.schema.type = 'object'; param.schema.type = 'object';
}
// This is the title that will be used by JsonEditor for the root // This is the title that will be used by JsonEditor for the root
// Since we already display the parameter's name in the Parameter column // Since we already display the parameter's name in the Parameter column
// We set this to space, we can't set it to null or space otherwise JsonEditor // We set this to space, we can't set it to null or space otherwise JsonEditor
// will replace it with the text "root" which won't look good on screen // will replace it with the text "root" which won't look good on screen
if(!param.schema.title){
param.schema.title = ' '; param.schema.title = ' ';
} }
}
var paramView = new SwaggerUi.Views.ParameterView({ var paramView = new SwaggerUi.Views.ParameterView({