From ed41c336a326d34ef80375785ff57838c1c7c148 Mon Sep 17 00:00:00 2001 From: Aaron Baker Date: Wed, 5 Aug 2015 12:42:47 +0100 Subject: [PATCH] Issue #1423: responses containing references to definitions were not being fully resolved when the spec was pulled in over AJAX but was working locally. OperationView.render()'s parsing of the responses was just checking if the ref _started_ with '#/definitions/', not whether it contained it, and when pulled in over AJAX the refs have the URL prepended to them --- src/main/javascript/view/OperationView.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/javascript/view/OperationView.js b/src/main/javascript/view/OperationView.js index 6891f5a1..e4be8004 100644 --- a/src/main/javascript/view/OperationView.js +++ b/src/main/javascript/view/OperationView.js @@ -139,8 +139,8 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({ schemaObj = this.model.responses[code].schema; if (schemaObj && schemaObj.$ref) { schema = schemaObj.$ref; - if (schema.indexOf('#/definitions/') === 0) { - schema = schema.substring('#/definitions/'.length); + if (schema.indexOf('#/definitions/') !== -1) { + schema = schema.replace(/^.*#\/definitions\//, ''); } } this.model.responseMessages.push({