Merge branch 'JSONEditor' into JSONEditorMaster
Conflicts: dist/swagger-ui.js dist/swagger-ui.min.js src/main/less/screen.less
This commit is contained in:
@@ -69,6 +69,16 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
|
||||
this.model.validatorUrl = 'http://online.swagger.io/validator';
|
||||
}
|
||||
}
|
||||
|
||||
// JSonEditor requires type='object' to be present on defined types, we add it if it's missing
|
||||
// is there any valid case were it should not be added ?
|
||||
var def;
|
||||
for(def in this.model.definitions){
|
||||
if (this.model.definitions[def].type === null){
|
||||
this.model.definitions[def].type = 'object';
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
render: function(){
|
||||
@@ -119,6 +129,11 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
|
||||
addResource: function(resource, auths){
|
||||
// Render a resource and add it to resources li
|
||||
resource.id = resource.id.replace(/\s/g, '_');
|
||||
|
||||
// Make all definitions available at the root of the resource so that they can
|
||||
// be loaded by the JSonEditor
|
||||
resource.definitions = this.model.definitions;
|
||||
|
||||
var resourceView = new SwaggerUi.Views.ResourceView({
|
||||
model: resource,
|
||||
router: this.router,
|
||||
|
||||
Reference in New Issue
Block a user