Skip to content

Commit

Permalink
Merge pull request #29 from datapipe/master
Browse files Browse the repository at this point in the history
Only prepend #/definitions/ if value doesn't start with #/ in $ref
  • Loading branch information
fotinakis committed Aug 28, 2015
2 parents b01ef2b + 01bbdd2 commit b21c1c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/swagger/blocks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def as_json
elsif is_swagger_2_0? && value.is_a?(Hash)
result[key] = {}
value.each_pair {|k, v| result[key][k] = (v.respond_to?(:as_json) ? v.as_json : v) }
elsif is_swagger_2_0? && key.to_s.eql?('$ref') && (value.to_s !~ %r{^#/definitions/})
elsif is_swagger_2_0? && key.to_s.eql?('$ref') && (value.to_s !~ %r{^#/})
result[key] = "#/definitions/#{value}"
else
result[key] = value
Expand Down Expand Up @@ -753,4 +753,4 @@ def items(&block)
end
end
end
end
end

0 comments on commit b21c1c5

Please sign in to comment.