diff --git a/lib/google/api_client/discovery/schema.rb b/lib/google/api_client/discovery/schema.rb index f8a34b6b0..eebf7dddb 100644 --- a/lib/google/api_client/discovery/schema.rb +++ b/lib/google/api_client/discovery/schema.rb @@ -47,7 +47,8 @@ module Google # and excess object creation, but this hopefully shouldn't be an # issue since it should only be called only once per schema per # process. - if data.kind_of?(Hash) && data['$ref'] + if data.kind_of?(Hash) && + data['$ref'] && !data['$ref'].kind_of?(Hash) if data['$ref'].respond_to?(:to_str) reference = data['$ref'].to_str else