Skip to content

Commit

Permalink
Issue swagger-api#1423: responses containing references to definition…
Browse files Browse the repository at this point in the history
…s 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
  • Loading branch information
aaronb-cg committed Aug 5, 2015
1 parent c7c6972 commit ed41c33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/javascript/view/OperationView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit ed41c33

Please sign in to comment.