Giter VIP home page Giter VIP logo

swagger-diff's Introduction

Swagger::Diff

Build Status Gem Version

Swagger::Diff in action

You can tell me by the way I walk - Genesis

Swagger::Diff is a utility for comparing two different Open API Initiative (OAI) specifications (fka Swagger specifications). Its intended use is to determine whether a newer API specification is backwards-compatible with an older API specification. It provides both an RSpec matcher and helper functions that can be used directly. Specifications are considered backwards compatible if:

  • all path and verb combinations in the old specification are present in the new one
  • no request parameters are required in the new specification that were not required in the old one
  • all request parameters in the old specification are present in the new one
  • all request parameters in the old specification have the same type in the new one
  • all response attributes in the old specification are present in the new one
  • all response attributes in the old specification have the same type in the new one

It can also be used to enumerate all changes between two specifications (i.e., to generate a changelog).

Read more on the Civis Analytics blog.

Installation

Add this line to your application's Gemfile:

gem 'swagger-diff'

And then execute:

$ bundle

Or install it yourself as:

$ gem install swagger-diff

Usage

OAI specifications can be any valid OAI file format, raw or parsed:

  • the path to a file containing an OAI specification. This may be local (e.g., /path/to/specification.json) or remote (e.g., http://host.domain/specification.yml)
  • a Hash containing a parsed OAI specification (e.g., the output of JSON.parse)
  • a string of JSON containing an OAI specification
  • a string of YAML containing an OAI specification

RSpec

expect(<new>).to be_compatible_with(<old>)

If new is incompatible with old, the spec will fail and print a list of backwards-incompatibilities.

Direct Invocation

If you are not using RSpec, you can directly invoke the comparison function:

diff = Swagger::Diff::Diff.new(<old>, <new>)
diff.compatible?

It will return true if new is compatible with old, false otherwise. #incompatibilities will return a hash containing the incompatible endpoints, request parameters, and response attributes; e.g.,

{ endpoints: ['put /a/{}'],
  request_params: {
    'get /a/' => ['missing request param: limit (in: query, type: integer)'],
    'post /a/' => ['new required request param: extra'],
    'put /b/{}' => ['new required request param: extra']
  },
  response_attributes: {
    'post /a/' => ['missing attribute from 200 response: description (in: body, type: string)'],
    'get /a/{}' => ['missing attribute from 200 response: description (in: body, type: string)'],
    'put /b/{}' => ['missing attribute from 200 response: description (in: body, type: string)']
  }
}

You can also directly invoke the changes function:

diff = Swagger::Diff::Diff.new(<old>, <new>)
diff.changes

#changes will return a hash containing the changed endpoints, request parameters, and response attributes; e.g.,

{ new_endpoints: ['delete /pets/{}', 'get /pets/{}', 'post /pets'],
  new_request_params: {
    'get /pets' => ['new request param: tags (in: query, type: array)',
                    'new request param: limit (in: query, type: integer)'] },
  new_response_attributes: {},
  removed_endpoints: [],
  removed_request_params: {},
  removed_response_attributes: {}
}

Command-Line

It also includes a command-line version:

$ swagger-diff -i <old> <new>

swagger-diff will print a list of any backwards-incompatibilities new has when compared to old.

For backwards-compatibility with previous versions of swagger-diff, the -i argument is optional:

$ swagger-diff <old> <new>

The command-line version can also be used to generate a list of all changes (i.e., a changelog):

$ swagger-diff -c <old> <new>

Gem Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

See CONTRIBUTING.

License

Swagger::Diff is released under the BSD 3-Clause License.

OpenAPI (fka Swagger) Specification License

Swagger::Diff includes an unmodified copy of the OpenAPI Specification. The OpenAPI Specification is licensed under the Apache License, Version 2.0.

JSON Schema Specification License

Swagger::Diff includes an unmodified copy of the JSON Schema Specification, draft v4. The JSON Schema Specification is licensed under the Simplified BSD License.

swagger-diff's People

Contributors

jeffreyc avatar vfu116 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swagger-diff's Issues

swagger-diff failed, not much info from error

/var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:206:in hash_property': undefined method []' for true:TrueClass (NoMethodError) from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:223:in block in properties'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:216:in each' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:216:in properties'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:136:in schema' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:108:in refs'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:162:in nested' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:179:in properties_for_ref'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:226:in block in properties' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:216:in each'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:216:in properties' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:136:in schema'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:108:in refs' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:162:in nested'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:179:in properties_for_ref' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:226:in block in properties'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:216:in each' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:216:in properties'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:136:in schema' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:108:in refs'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:133:in schema' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:237:in block in request_params_inner'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:235:in each' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:235:in request_params_inner'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:19:in block in request_params' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:18:in each'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:18:in request_params' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:142:in block in changed_request_params_enumerator'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:112:in each' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:112:in each'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:112:in each' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:112:in change_hash'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:130:in new_or_changed_request_params' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:13:in changes'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:48:in changed_endpoints_message' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:21:in changes_message'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/exe/swagger-diff:40:in <top (required)>' from /usr/local/bin/swagger-diff:23:in load'
from /usr/local/bin/swagger-diff:23:in <main>'

I am getting this error after I run a swagger-diff on 2 json. Can anyone help why it is crashing? How to find if something within my json is breaking it ?

I used swagger-diff -c old.json new.json

New required form parameter is not a breaking change?

Hi. I am loving swagger-diff. But I noticed that if I add a new required form-based param, this does not cause swagger-diff to report a diff. If I change this to a query-param it does report a diff.

Is that correct? It seems like a new required form param would break clients...

Thanks!

David

Docker version

Hi,
This seems to be good for CI, but requires manual installation. Is it possible to create Docker image for it?
Thanks,
Assaf

swagger-diff requires name for parameter $ref

I use parameter references in my swagger specs, and the diff fails because it expects parameter to have name attribute provided.

As of Swagger Specs, parameter may contain a reference object, and reference object does not have name attribute.

My param-ref.yaml file


---
swagger: '2.0'
info:
  version: 0.0.0
  title: Simple API
paths:
  /:
    get:
      parameters:
        - $ref: "#/parameters/my-param"
      responses:
        200:
          description: OK
parameters:
  my-param:
    name: "my-param"
    in: "query"
    description: "My test param"
    required: false
    type: "boolean"

When I call swagger-tools param-ref.yaml param-ref.yaml (same file just for simplicity) I get the below error.

/var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:191:in `fail_property_required_error!': The property 'name' is required for Swagger::V2::Parameter. (ArgumentError)
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:183:in `assert_property_set!'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:178:in `block in assert_required_attributes_set!'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:177:in `each_key'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:177:in `assert_required_attributes_set!'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:100:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger/swagger_object.rb:16:in `initialize'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:68:in `new'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:68:in `block in coerce_or_init'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:43:in `call'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:43:in `block in set_value_with_coercion'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:43:in `map'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:43:in `set_value_with_coercion'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/indifferent_access.rb:107:in `indifferent_writer'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:168:in `block in initialize_attributes'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:167:in `each_pair'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:167:in `initialize_attributes'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:99:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger/swagger_object.rb:16:in `initialize'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:68:in `new'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:68:in `block in coerce_or_init'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:35:in `call'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:35:in `set_value_with_coercion'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/indifferent_access.rb:107:in `indifferent_writer'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:168:in `block in initialize_attributes'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:167:in `each_pair'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:167:in `initialize_attributes'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:99:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger/swagger_object.rb:16:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger/v2/path.rb:20:in `initialize'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:68:in `new'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:68:in `block in coerce_or_init'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:40:in `call'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:40:in `block in set_value_with_coercion'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:40:in `each'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:40:in `map'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:40:in `set_value_with_coercion'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/indifferent_access.rb:107:in `indifferent_writer'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:168:in `block in initialize_attributes'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:167:in `each_pair'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:167:in `initialize_attributes'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:99:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger/swagger_object.rb:16:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger/api.rb:21:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger/api.rb:9:in `new'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger/api.rb:9:in `build_api'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger.rb:24:in `build'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger.rb:35:in `load'
    from /var/lib/gems/2.1.0/gems/swagger-diff-1.0.5/lib/swagger/diff/specification.rb:54:in `parse_swagger'
    from /var/lib/gems/2.1.0/gems/swagger-diff-1.0.5/lib/swagger/diff/specification.rb:6:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:5:in `new'
    from /var/lib/gems/2.1.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:5:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-diff-1.0.5/exe/swagger-diff:6:in `new'
    from /var/lib/gems/2.1.0/gems/swagger-diff-1.0.5/exe/swagger-diff:6:in `<top (required)>'
    from /usr/local/bin/swagger-diff:23:in `load'
    from /usr/local/bin/swagger-diff:23:in `<main>'

response_attributes_inner': undefined method `each' for nil:NilClass (NoMethodError)

Great tool, thanks for sharing.
We find that it works in some cases, but not in all cases.

swagger-diff 176.json 179.json

C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/specification.rb:206:in `response_attributes_inner': undefined method `each' for nil:NilClass (NoMethodError)
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/specification.rb:28:in `block in response_attributes'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/specification.rb:27:in `each'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/specification.rb:27:in `response_attributes'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:118:in `block (2 levels) in incompatible_response_attributes_enumerator'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:117:in `each'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:117:in `block in incompatible_response_attributes_enumerator'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:142:in `each'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:142:in `each'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:142:in `each'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:142:in `none?'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:142:in `responses_compatible?'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:10:in `compatible?'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/exe/swagger-diff:8:in `<top (required)>'
        from C:/U/Ruby/bin/swagger-diff:23:in `load'
        from C:/U/Ruby/bin/swagger-diff:23:in `<main>'

Here's another one with a different error.
swagger-diff 122.json 1.1_5.4-37-176.json

C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-core-0.2.3/lib/swagger/api.rb:11:in `build_api': Swagger version  is not currently supported (ArgumentError)
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-core-0.2.3/lib/swagger.rb:24:in `build'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/specification.rb:65:in `rescue in parse_swagger'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/specification.rb:57:in `parse_swagger'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/specification.rb:6:in `initialize'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:5:in `new'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:5:in `initialize'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/exe/swagger-diff:6:in `new'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/exe/swagger-diff:6:in `<top (required)>'
        from C:/U/Ruby/bin/swagger-diff:23:in `load'
        from C:/U/Ruby/bin/swagger-diff:23:in `<main>'

D:\Dev\Schemas>swagger-diff 1.0_5.5-1-122.json 1.0_5.4-37-176.json
C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-core-0.2.3/lib/swagger/api.rb:11:in `build_api': Swagger version  is not currently supported (ArgumentError)
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-core-0.2.3/lib/swagger.rb:24:in `build'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/specification.rb:65:in `rescue in parse_swagger'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/specification.rb:57:in `parse_swagger'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/specification.rb:6:in `initialize'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:5:in `new'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:5:in `initialize'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/exe/swagger-diff:6:in `new'
        from C:/U/Ruby/lib/ruby/gems/2.2.0/gems/swagger-diff-1.0.5/exe/swagger-diff:6:in `<top (required)>'
        from C:/U/Ruby/bin/swagger-diff:23:in `load'
        from C:/U/Ruby/bin/swagger-diff:23:in `<main>'

Thanks

Optional Array with required attributes

On a POST to endpoint /foo with an attribute bars of type array of elements Bar, the diff throws the following error:

- post /foo/
  - new required request param: bars[]/name
  - new required request param: bars[]/value

bars is a new attribute on the POST /foo endpoint. Both name and value are required attributes of Bar elements in the array. If the root element bars is new, I would expect that that is not a breaking changes to the contract.

cc @jeffreyc

maven swagger-diff issue - NoMethodError: undefined method `lazy' for #<Enumerator:0x230232b0>

Using maven and swagger-diff gems with jruby-complete 1.7.21

    <dependency>
      <groupId>org.jruby</groupId>
      <artifactId>jruby-complete</artifactId>
      <version>1.7.21</version>
      <scope>test</scope>
    </dependency>
[INFO] --- gem-maven-plugin:1.1.3:initialize (installing swagger-diff gems) @ sdk-docs ---
[INFO] Successfully installed swagger-diff-1.0.5
[INFO] Successfully installed swagger-core-0.2.3
[INFO] Successfully installed addressable-2.3.8
[INFO] Successfully installed hashie-3.3.2
[INFO] Successfully installed json-schema-2.6.0
[INFO] Successfully installed mime-types-2.99
[INFO] Successfully installed rspec-expectations-3.4.0
[INFO] Successfully installed rspec-support-3.4.1
[INFO] Successfully installed diff-lcs-1.2.5
[INFO] 9 gems installed
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ sdk-docs ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ sdk-docs ---
[INFO] No sources to compile
[INFO] 
[INFO] --- gem-maven-plugin:1.1.3:exec (performing the actual swagger-diff to check for backward compatibility) @ sdk-docs ---
[INFO] NoMethodError: undefined method `lazy' for #<Enumerator:0x230232b0>
[INFO]   incompatible_request_params_enumerator at /Users/kamalr/git/spring-rest-swagger/sdk/sdk-docs/target/rubygems/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:91
[INFO]                     requests_compatible? at /Users/kamalr/git/spring-rest-swagger/sdk/sdk-docs/target/rubygems/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:138
[INFO]                              compatible? at /Users/kamalr/git/spring-rest-swagger/sdk/sdk-docs/target/rubygems/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:10
[INFO]                                   (root) at /Users/kamalr/git/spring-rest-swagger/sdk/sdk-docs/target/rubygems/gems/swagger-diff-1.0.5/exe/swagger-diff:8
[INFO]                                     load at org/jruby/RubyKernel.java:1059
[INFO]                                   (root) at /Users/kamalr/git/spring-rest-swagger/sdk/sdk-docs/target/rubygems/bin/swagger-diff:23

Any inputs/suggestions will be great.

Show differences for similar Swagger Docs

Hi,

I have 2 Swagger docs. One was created manually, one - automatically. Swagger-diff shows a lot of discrepancies between documents. However in Swagger Editor both documents looks similar. Please see swagger-diff output and documents below.

Thank you in advance for help,

Swagger-diff output:

- incompatible response attributes
  - get /internal/v0/orgs/{}/facs
    - missing attribute from 200 response: data[]/orgId (in: body, type: integer)
    - missing attribute from 200 response: data[]/facId (in: body, type: integer)
    - missing attribute from 200 response: data[]/facilityName (in: body, type: string)
    - missing attribute from 200 response: data[]/country (in: body, type: string)
    - missing attribute from 200 response: data[]/addressLine1 (in: body, type: string)
    - missing attribute from 200 response: data[]/addressLine2 (in: body, type: string)
    - missing attribute from 200 response: data[]/postalCode (in: body, type: string)
    - missing attribute from 200 response: data[]/phone (in: body, type: string)
    - missing attribute from 200 response: data[]/city (in: body, type: string)
    - missing attribute from 200 response: data[]/state (in: body, type: string)
    - missing attribute from 200 response: data[]/fax (in: body, type: string)
    - missing attribute from 200 response: data[]/emailAddress (in: body, type: string)
    - missing attribute from 200 response: data[]/inactiveDate (in: body, type: string)
    - missing attribute from 200 response: data[]/bedCount (in: body, type: integer)
    - missing attribute from 200 response: data[]/lineOfBusiness/shortDesc (in: body, type: string)
    - missing attribute from 200 response: data[]/lineOfBusiness/longDesc (in: body, type: string)
    - missing attribute from 200 response: data[]/healthType (in: body, type: string)
    - missing attribute from 200 response: data[]/facilityCode (in: body, type: string)
    - missing attribute from 200 response: data[]/billingStyleCountry (in: body, type: string)
    - missing attribute from 200 response: data[]/timeZone (in: body, type: string)
    - missing attribute from 200 response: data[]/active (in: body, type: boolean)
    - missing attribute from 200 response: data[]/headOffice (in: body, type: boolean)
    - missing attribute from 200 response: paging/page (in: body, type: integer)
    - missing attribute from 200 response: paging/pageSize (in: body, type: integer)
    - missing attribute from 200 response: paging/hasMore (in: body, type: boolean)

---------------------Document 1----------------------------------

{
    "swagger": "2.0",
    "info": {
        "version": "1.0.0",
        "title": "API",
        "contact": {
            "name": "Dev Relations",
            "url": "https://developer.XXX.com",
            "email": "[email protected]"
        }
    },
    "host": "connect.XXX.com",
    "basePath": "/api",
    "schemes": [
        "https"
    ],
    "consumes": [
        "application/json"
    ],
    "produces": [
        "application/json"
    ],
    "paths": {
        "/internal/v0/orgs/{orgId}/facs": {
            "get": {
                "tags": [
                    "Facilities"
                ],
                "summary": "List of facilities within an organization.",
                "description": "",
                "operationId": "Facility List (Internal)",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "healthType",
                        "in": "query",
                        "description": "If provided, return only facilities with a matching health type.",
                        "required": false,
                        "type": "string",
                        "x-example": "false"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "The limit used in the execution of the query; default is 50.",
                        "required": false,
                        "type": "integer",
                        "x-example": "false"
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "description": "The offset used in the execution of the query; default is 0.",
                        "required": false,
                        "type": "integer",
                        "x-example": "false"
                    },
                    {
                        "name": "orgId",
                        "in": "path",
                        "description": "XXX's unique identifier for the organization.",
                        "required": true,
                        "type": "integer",
                        "x-example": 10000003
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/FacilityList"
                        }
                    },
                    "400": {
                        "description": "Bad Request"
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "500": {
                        "description": "Internal Server Error"
                    }
                },
                "x-authorization": {
                    "name": "2-legged",
                    "description": "This API requires a 2-legged OAuth access token."
                }
            }
        }
    },
    "definitions": {
        "PagingResponseByPage": {
            "type": "object",
            "properties": {
                "page": {
                    "type": "integer",
                    "format": "int32",
                    "description": "Represents the current page number for which the records are returned."
                },
                "pageSize": {
                    "type": "integer",
                    "format": "int32",
                    "description": "Represents the number of records returned in the response."
                },
                "hasMore": {
                    "type": "boolean",
                    "description": "Identifies if there are further records in the list. Possible responses are 'true' or 'false'.",
                    "default": false
                }
            },
            "example": {
                "page": 1,
                "pageSize": 50,
                "hasMore": false
            }
        },
        "FacilityList": {
            "type": "object",
            "properties": {
                "data": {
                    "type": "array",
                    "description": "List of facilities",
                    "items": {
                        "$ref": "#/definitions/Facility"
                    }
                },
                "paging": {
                    "$ref": "#/definitions/PagingResponseByPage"
                }
            },
        },
        "FacilityLineOfBusiness": {
            "type": "object",
            "properties": {
                "shortDesc": {
                    "type": "string",
                    "description": "A short description of the facility's line of business"
                },
                "longDesc": {
                    "type": "string",
                    "description": "A long description of the facility's line of business"
                }
            },
            "example": {
                "shortDesc": "Short Description",
                "longDesc": "Long Description"
            }
        },
        "Facility": {
            "type": "object",
            "required": [
                "addressLine1",
                "addressLine2",
                "city",
                "emailAddress",
                "facilityName",
                "fax",
                "healthType",
                "phone",
                "postalCode",
                "state"
            ],
            "properties": {
                "orgId": {
                    "type": "integer",
                    "format": "int32",
                    "description": "XXX's unique identifier for the organization. "
                },
                "facId": {
                    "type": "integer",
                    "format": "int32",
                    "description": "XXX's unique identifier for a facility within the organization. "
                },
                "facilityName": {
                    "type": "string",
                    "description": "The name of the facility. ",
                    "minLength": 1,
                    "maxLength": 2147483647
                },
                "country": {
                    "type": "string",
                    "description": "The ISO 3166 3 letter code for the country the facility resides in. (Example: USA for United States and CAN for Canada). ",
                    "enum": [
                        "USA",
                        "CAN"
                    ]
                },
                "addressLine1": {
                    "type": "string",
                    "description": "The address of the facility. ",
                    "minLength": 1,
                    "maxLength": 2147483647
                },
                "addressLine2": {
                    "type": "string",
                    "description": "Additional address information for the facility. ",
                    "minLength": 1,
                    "maxLength": 2147483647
                },
                "postalCode": {
                    "type": "string",
                    "description": "The postal/zip code of the facility. ",
                    "minLength": 1,
                    "maxLength": 2147483647
                },
                "phone": {
                    "type": "string",
                    "description": "The phone number of the facility, if available. ",
                    "minLength": 1,
                    "maxLength": 2147483647
                },
                "city": {
                    "type": "string",
                    "description": "The city of the facility. ",
                    "minLength": 1,
                    "maxLength": 2147483647
                },
                "state": {
                    "type": "string",
                    "description": "The state/province/territory of the facility. ",
                    "minLength": 1,
                    "maxLength": 2147483647
                },
                "fax": {
                    "type": "string",
                    "description": "The fax number of the facility, if available. ",
                    "minLength": 1,
                    "maxLength": 2147483647
                },
                "emailAddress": {
                    "type": "string",
                    "description": "The contact email address of the facility, if available. ",
                    "minLength": 1,
                    "maxLength": 2147483647
                },
                "inactiveDate": {
                    "type": "string",
                    "format": "date",
                    "description": "Represents the date at which a facility became inactive. The date format is YYYY-MM-DD. "
                },
                "bedCount": {
                    "type": "integer",
                    "format": "int32",
                    "description": "The number of beds the facility offers, if available. "
                },
                "lineOfBusiness": {
                    "$ref": "#/definitions/FacilityLineOfBusiness"
                },
                "healthType": {
                    "type": "string",
                    "description": "The health type of the facility (Example: XXX).",
                    "minLength": 1,
                    "maxLength": 2147483647
                },
                "facilityCode": {
                    "type": "string",
                    "description": "Another unique identifier for the facility. Facility code can be configured by an organization in the XXX application."
                },
                "billingStyleCountry": {
                    "type": "string",
                    "description": "The ISO 3166 3 letter code for the country whose billing style the facility uses. (Example: USA for United States and CAN for Canada). ",
                    "enum": [
                        "USA",
                        "CAN"
                    ]
                },
                "timeZone": {
                    "type": "string",
                    "description": "Represents the timezone the facility operates in."
                },
                "active": {
                    "type": "boolean",
                    "description": "Represents whether if the facility is active or inactive. Possible responses are 'true' or 'false'. ",
                    "default": false
                },
                "headOffice": {
                    "type": "boolean",
                    "description": "Represents whether if the facility is the head office.  Some organizations have a concept of a 'head office' facility which is usually for administrative purposes only and this facility would not contain actual patients. Possible responses are 'true' or 'false'. ",
                    "default": false
                }
            }
        }
    }
}

----------------------Document 2---------------------------------

{
    "swagger": "2.0",
    "info": {
        "description": "API Documentation",
        "version": "1.0.0",
        "title": "API Documentation",
        "termsOfService": "http://XXX.com",
        "contact": {
            "url": "http://XXX.com",
            "name": "XXX",
            "email": "[email protected]"
        }
    },
    "host": "apiqa.XXX.com",
    "basePath": "/api",
    "schemes": [
        "http",
        "https"
    ],
    "tags": [
        {
            "name": "Others",
            "description": "Others"
        }
    ],
    "paths": {
        "/internal/v0/orgs/{orgId}/facs": {
            "get": {
                "tags": [
                    "Others"
                ],
                "summary": "",
                "description": "",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "orgId",
                        "in": "path",
                        "required": true,
                        "type": "integer"
                    },
                    {
                        "name": "healthType",
                        "in": "query",
                        "required": false,
                        "type": "string"
                    },
                    {
                        "name": "includeHeadOffice",
                        "in": "query",
                        "required": false,
                        "type": "boolean"
                    },
                    {
                        "name": "includeInactive",
                        "in": "query",
                        "required": false,
                        "type": "boolean"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "type": "integer"
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "type": "integer"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "properties": {
                                "data": {
                                    "type": "array",
                                    "items": {
                                        "properties": {
                                            "active": {
                                                "type": "boolean"
                                            },
                                            "addressLine1": {
                                                "type": "string",
                                                "description": "Address Line 1 (max length 35)"
                                            },
                                            "addressLine2": {
                                                "type": "string",
                                                "description": "Address Line 2 (max length 35)"
                                            },
                                            "bedCount": {
                                                "type": "integer",
                                                "description": "Number of beds"
                                            },
                                            "billingStyleCountry": {
                                                "default": "USA",
                                                "type": "string",
                                                "description": "Billing country Code",
                                                "enum": [
                                                    "USA",
                                                    "CAN"
                                                ]
                                            },
                                            "city": {
                                                "type": "string",
                                                "description": "City Name (max length 50)"
                                            },
                                            "clinicalConfiguration": {
                                                "properties": {
                                                    "unitOfMeasure": {
                                                        "properties": {
                                                            "bloodPressure": {
                                                                "type": "string"
                                                            },
                                                            "bloodSugar": {
                                                                "type": "string"
                                                            },
                                                            "heartRate": {
                                                                "type": "string"
                                                            },
                                                            "height": {
                                                                "type": "string"
                                                            },
                                                            "oxygenSaturation": {
                                                                "type": "string"
                                                            },
                                                            "respirations": {
                                                                "type": "string"
                                                            },
                                                            "temperature": {
                                                                "type": "string"
                                                            },
                                                            "weight": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    },
                                                    "weightScaleTypes": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "string"
                                                        }
                                                    }
                                                }
                                            },
                                            "country": {
                                                "default": "USA",
                                                "type": "string",
                                                "description": "Country Code",
                                                "enum": [
                                                    "USA",
                                                    "CAN"
                                                ]
                                            },
                                            "emailAddress": {
                                                "type": "string",
                                                "description": "Primary email (max length 75)"
                                            },
                                            "facId": {
                                                "default": 1,
                                                "type": "integer",
                                                "description": "Facility code"
                                            },
                                            "facilityCode": {
                                                "type": "string",
                                                "description": "Code of facility"
                                            },
                                            "facilityName": {
                                                "type": "string",
                                                "description": "Facility Name (max length 75)"
                                            },
                                            "fax": {
                                                "type": "string",
                                                "description": "Fax number (max length 35)"
                                            },
                                            "generalConfiguration": {
                                                "properties": {
                                                    "assessment": {
                                                        "properties": {
                                                            "electronicSignature": {
                                                                "properties": {
                                                                    "description": {
                                                                        "type": "string"
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            },
                                            "headOffice": {
                                                "type": "boolean"
                                            },
                                            "healthType": {
                                                "type": "string",
                                                "description": "Type of facility, possible values: SNF, ILF,ALF (max length 10)"
                                            },
                                            "inactiveDate": {
                                                "type": "string",
                                                "format": "date",
                                                "description": "Inactivation date"
                                            },
                                            "lineOfBusiness": {
                                                "properties": {
                                                    "longDesc": {
                                                        "type": "string"
                                                    },
                                                    "shortDesc": {
                                                        "type": "string"
                                                    }
                                                },
                                                "description": "Line of Business"
                                            },
                                            "orgId": {
                                                "default": 1401,
                                                "type": "integer",
                                                "description": "Organization code"
                                            },
                                            "phone": {
                                                "type": "string",
                                                "description": "Main phone (max length 35)"
                                            },
                                            "postalCode": {
                                                "type": "string",
                                                "description": "Postal/ZIP code (max length 15)"
                                            },
                                            "reportFilters": {
                                                "type": "array",
                                                "items": {
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "reportFilterItems": {
                                                            "type": "array",
                                                            "items": {
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            },
                                            "state": {
                                                "type": "string",
                                                "description": "State code (max length 3)"
                                            },
                                            "timeZone": {
                                                "default": "America/New_York",
                                                "type": "string",
                                                "description": "Time Zone Code from IANA time zone database (https://www.iana.org/time-zones). Day Light Time support depends on Time Zone, please refer to IANA time zone database. Supported values: Europe/London, UTC, America/Halifax, America/Barbados, America/New_York, EST, America/Chicago, America/Regina, America/Denver, America/Phoenix, America/Los_Angeles, America/Metlakatla, America/Anchorage, Pacific/Gambier, US/Aleutian, Pacific/Honolulu, Asia/Hong_Kong."
                                            }
                                        }
                                    }
                                },
                                "paging": {
                                    "properties": {
                                        "hasMore": {
                                            "type": "boolean"
                                        },
                                        "limit": {
                                            "type": "integer"
                                        },
                                        "offset": {
                                            "type": "integer"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request"
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "404": {
                        "description": "Not Found"
                    },
                    "500": {
                        "description": "Internal Server Error"
                    }
                }
            }
        }
    },
    "securityDefinitions": {},
    "definitions": {}
}

Support for extensions

A colleague added an extension to our Swagger (using the @extension annotation for Jersey) that looks like this:

extensions = { @Extension(properties = { @ExtensionProperty(name = "x-cached", value = "true") }) })

This causes swagger-diff to fail:

   Hashie::CoercionError: Cannot coerce property "get" from Hash to Swagger::V2::Operation: The property 'x-cached' is not defined for Swagger::V2::Operation.
    /home/jenkins/.rvm/gems/ruby-2.1.2/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:46:in `rescue in set_value_with_coercion'
    /home/jenkins/.rvm/gems/ruby-2.1.2/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:34:in `set_value_with_coercion'
    /home/jenkins/.rvm/gems/ruby-2.1.2/gems/hashie-3.3.2/lib/hashie/extensions/indifferent_access.rb:107:in `indifferent_writer'
    /home/jenkins/.rvm/gems/ruby-2.1.2/gems/hashie-3.3.2/lib/hashie/dash.rb:168:in `block in initialize_attributes'
    /home/jenkins/.rvm/gems/ruby-2.1.2/gems/hashie-3.3.2/lib/hashie/dash.rb:167:in `each_pair'
    /home/jenkins/.rvm/gems/ruby-2.1.2/gems/hashie-3.3.2/lib/hashie/dash.rb:167:in `initialize_attributes'
    /home/jenkins/.rvm/gems/ruby-2.1.2/gems/hashie-3.3.2/lib/hashie/dash.rb:99:in `initialize'
    /home/jenkins/.rvm/gems/ruby-2.1.2/gems/swagger-core-0.2.3/lib/swagger/swagger_object.rb:16:in `initialize'

Is there any chance we could fix this?

Thanks,

David

NoMethodError 'rindex' for nil with array parameter

Darn, found another one with the next Swagger output

NoMethodError:         NoMethodError: undefined method `rindex' for nil:NilClass
            /Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:87:in `refs'
            /Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:196:in `block in request_params_inner'
            /Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:193:in `each'
            /Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:193:in `request_params_inner'
            /Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:18:in `block in request_params'
            /Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:17:in `each'
            /Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:17:in `request_params'
            /Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:92:in `block in incompatible_request_params_enumerator'
            /Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:138:in `each'
            /Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:138:in `each'
            /Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:138:in `each'
            /Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:138:in `none?'
            /Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:138:in `requests_compatible?'
            /Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:10:in `compatible?'

I put in a puts statement and this is the parameter that's barfing:

#<Swagger::V2::Parameter description="object representing list of provider details which will be added to care team" in="body" name="body" required=true schema=#<Swagger::Schema items=#<Swagger::Schema $ref="#/definitions/CareTeamProvider"> type="array">>

I am attaching the full Swagger JSON I am trying to work with
careteam.txt

Error regarding /# when diffing swagger

Environment:
swagger-diff 1.1.1
Windows 8

Comands:
gem install swagger-diff
swagger-diff -i staging-swagger.json dev-swagger.json (files have been renamed in order to upload)

Output:
The property '#/' of type string did not match the following type: object in schema http://swagger.io/v2/schema.json#
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/swagger-diff-1.1.1/lib/swagger/diff/specification.rb:73:in parsed_to_hash': undefined method each' for nil:NilClass (NoMethodError)
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/swagger-diff-1.1.1/lib/swagger/diff/specification.rb:8:in initialize' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/swagger-diff-1.1.1/lib/swagger/diff/diff.rb:6:in new'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/swagger-diff-1.1.1/lib/swagger/diff/diff.rb:6:in initialize' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/swagger-diff-1.1.1/exe/swagger-diff:37:in new'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/swagger-diff-1.1.1/exe/swagger-diff:37:in <top (required)>' from C:/Ruby23-x64/bin/swagger-diff:22:in load'
from C:/Ruby23-x64/bin/swagger-diff:22:in `

'

dev-swagger.json.txt
staging-swagger.json.txt

OpenAPI v3

Hi there!
As far as I see, swagger-diff doesn't support specifications in OpenAPI v3 format.
Please correct me if I'm wrong or share your plans.
Is v3 support somewhere on the roadmap?

Swagger-Diff not erroring on major changes

This may very well be a PEBCAK but I'm trying to run a swagger-diff in jenkins and get Jenkins to fail when there are differences detected. Now I'm running with
npx swagger-diff <one> <two>

I expect to get back an error since they're two completely different specs, but instead all I get back is warnings. Am I using this right? Should I be doing something different instead? The idea I'd like to do here is just monitor my API's and have Jenkins email me when it does detect a difference, and there's not much documentation on how to read the CLI output.

Thanks!

return type with no $ref causing failure

I am getting this error when processing a Swagger JSON:

NoMethodError:         NoMethodError: undefined method `rindex' for nil:NilClass
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:88:in `refs'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:186:in `block in response_attributes_inner'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:176:in `each'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:176:in `response_attributes_inner'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:28:in `block in response_attributes'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:27:in `each'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:27:in `response_attributes'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:117:in `block in incompatible_response_attributes_enumerator'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:108:in `each'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:108:in `each'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:108:in `each'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:108:in `incompatible_response_attributes'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:16:in `incompatibilities'

I am attaching the JSON that causes the error

Unsupported response $ref

I have a swagger file containing $refs to pre-defined responses. swagger-diff fails with an error:

My resp-ref.yaml file:


---
swagger: '2.0'
info:
  version: 0.0.0
  title: Simple API
paths:
  /:
    get:
      responses:
        202:
          description: OK
        default:
          $ref: "#/responses/apiError"
responses:
  apiError:
    description: "Any erroneous status code: 400 (parse error), 401 (auth error),\
      \ 402 (trial access), 403 (insufficient permissions), 404 (not found), 405 (unsupported\
      \ HTTP method), 415 (unsupported content type, 422 (validation error), 429 (request\
      \ rate limit exceeded), 500 (server error), 503 (maintenance)"
    schema:
      type: 'object'

When calling swagger-diff resp-ref.yaml resp-ref.yaml (I use same file for simplicity)
Error I am getting:

/var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:46:in `rescue in set_value_with_coercion': Cannot coerce property "responses" from Hash to {String=>Swagger::V2::Response}: The property '$ref' is not defined for Swagger::V2::Response. (Hashie::CoercionError)
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:34:in `set_value_with_coercion'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/indifferent_access.rb:107:in `indifferent_writer'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:168:in `block in initialize_attributes'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:167:in `each_pair'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:167:in `initialize_attributes'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:99:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger/swagger_object.rb:16:in `initialize'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:68:in `new'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:68:in `block in coerce_or_init'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:35:in `call'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:35:in `set_value_with_coercion'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/indifferent_access.rb:107:in `indifferent_writer'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:168:in `block in initialize_attributes'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:167:in `each_pair'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:167:in `initialize_attributes'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:99:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger/swagger_object.rb:16:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger/v2/path.rb:20:in `initialize'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:68:in `new'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:68:in `block in coerce_or_init'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:40:in `call'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:40:in `block in set_value_with_coercion'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:40:in `each'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:40:in `map'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/coercion.rb:40:in `set_value_with_coercion'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/extensions/indifferent_access.rb:107:in `indifferent_writer'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:168:in `block in initialize_attributes'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:167:in `each_pair'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:167:in `initialize_attributes'
    from /var/lib/gems/2.1.0/gems/hashie-3.3.2/lib/hashie/dash.rb:99:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger/swagger_object.rb:16:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger/api.rb:21:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger/api.rb:9:in `new'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger/api.rb:9:in `build_api'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger.rb:24:in `build'
    from /var/lib/gems/2.1.0/gems/swagger-core-0.2.3/lib/swagger.rb:35:in `load'
    from /var/lib/gems/2.1.0/gems/swagger-diff-1.0.5/lib/swagger/diff/specification.rb:54:in `parse_swagger'
    from /var/lib/gems/2.1.0/gems/swagger-diff-1.0.5/lib/swagger/diff/specification.rb:6:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:5:in `new'
    from /var/lib/gems/2.1.0/gems/swagger-diff-1.0.5/lib/swagger/diff/diff.rb:5:in `initialize'
    from /var/lib/gems/2.1.0/gems/swagger-diff-1.0.5/exe/swagger-diff:6:in `new'
    from /var/lib/gems/2.1.0/gems/swagger-diff-1.0.5/exe/swagger-diff:6:in `<top (required)>'
    from /usr/local/bin/swagger-diff:23:in `load'
    from /usr/local/bin/swagger-diff:23:in `<main>'

APIs.guru: showcase and test on real-life APIs

Hi @jeffreyc,

Maybe you would be interested in testing your tool against 200+ real-life Swagger files:
https://github.com/APIs-guru/api-models
They are validated by sway and could accessed through my REST API(no key needed).

You can also compare different versions of some popular API like Google Drive:
https://apis-guru.github.io/api-models/googleapis.com/drive/v1/swagger.yaml
https://apis-guru.github.io/api-models/googleapis.com/drive/v2/swagger.yaml
https://apis-guru.github.io/api-models/googleapis.com/drive/v3/swagger.yaml
IMHO it will help other developers to see all features of your tool.
All links support CORS so you can use it in online demo.

If you have any questions you can ask me directly through Skype(ivangon4arov), Hangout([email protected]) or you can ask them on public chat: https://gitter.im/APIs-guru/api-models

swagger-diff failed

/var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:206:in hash_property': undefined method []' for true:TrueClass (NoMethodError) from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:223:in block in properties'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:216:in each' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:216:in properties'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:136:in schema' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:108:in refs'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:162:in nested' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:179:in properties_for_ref'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:226:in block in properties' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:216:in each'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:216:in properties' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:136:in schema'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:108:in refs' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:162:in nested'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:179:in properties_for_ref' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:226:in block in properties'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:216:in each' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:216:in properties'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:136:in schema' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:108:in refs'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:133:in schema' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:237:in block in request_params_inner'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:235:in each' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:235:in request_params_inner'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:19:in block in request_params' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:18:in each'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/specification.rb:18:in request_params' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:142:in block in changed_request_params_enumerator'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:112:in each' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:112:in each'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:112:in each' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:112:in change_hash'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:130:in new_or_changed_request_params' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:13:in changes'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:48:in changed_endpoints_message' from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/lib/swagger/diff/diff.rb:21:in changes_message'
from /var/lib/gems/2.1.0/gems/swagger-diff-1.1.0/exe/swagger-diff:40:in <top (required)>' from /usr/local/bin/swagger-diff:23:in load'
from /usr/local/bin/swagger-diff:23:in <main>

I am getting this error after I run a swagger-diff on 2 json. Can anyone help why it is crashing? How to find if something within my json is breaking it ?

I used swagger-diff -c old.json new.json

Diff Models

It would be really useful if swagger-diff would report changes within the models themselves, such as the removal of a field or making a field required.

slow processing speed

Are there any known issues around slow processing speeds with larger specifications? I have a spec with around something like 290 operations and 136 models. It takes around 45 minutes to run the cli on it. Is that expected, or does it point to a problem in my spec (attached if curious)?

Thanks

swagger.zip

Please add XML output

Hi,

Great job!

Just please add XML output option to be able to use this great tool in different automatons.

Thank you,

Running Swagger-Diff on local files

Hi, is it possible to run swagger-diff with local files instead of passing in a url? I'm assuming that under the hood it is doing a GET to retrieve the data. Basically I have a script to reduce the swagger files down to just the paths we care about for our application, but when I pass my JSON files in I get an error that says they are unable to be parsed, and that it expects an end of stream or document separator.

This is the error:

SyntaxError: Error parsing "c:/Users/dolezalc/Desktop/Chloe/QA/old.json"
end of the stream or a document separator is expected at line 1, column 4:
��{
^
at Function.ono [as syntax] (C:\Users\dolezalc\AppData\Roaming\npm-cache_npx\56432\node_modules\swagger-diff\node_modules\ono\lib\index.js:61:20)
at parse (C:\Users\dolezalc\AppData\Roaming\npm-cache_npx\56432\node_modules\swagger-diff\node_modules\json-schema-ref-parser\lib\parse.js:47:17)
at C:\Users\dolezalc\AppData\Roaming\npm-cache_npx\56432\node_modules\swagger-diff\node_modules\json-schema-ref-parser\lib\read.js:70:23

YAMLException: end of the stream or a document separator is expected at line 1, column 4:
��{
^
at generateError (C:\Users\dolezalc\AppData\Roaming\npm-cache_npx\56432\node_modules\swagger-diff\node_modules\js-yaml\lib\js-yaml\loader.js:165:10)
at throwError (C:\Users\dolezalc\AppData\Roaming\npm-cache_npx\56432\node_modules\swagger-diff\node_modules\js-yaml\lib\js-yaml\loader.js:171:9)
at readDocument (C:\Users\dolezalc\AppData\Roaming\npm-cache_npx\56432\node_modules\swagger-diff\node_modules\js-yaml\lib\js-yaml\loader.js:1512:5)
at loadDocuments (C:\Users\dolezalc\AppData\Roaming\npm-cache_npx\56432\node_modules\swagger-diff\node_modules\js-yaml\lib\js-yaml\loader.js:1548:5)
at load (C:\Users\dolezalc\AppData\Roaming\npm-cache_npx\56432\node_modules\swagger-diff\node_modules\js-yaml\lib\js-yaml\loader.js:1569:19)
at Object.safeLoad (C:\Users\dolezalc\AppData\Roaming\npm-cache_npx\56432\node_modules\swagger-diff\node_modules\js-yaml\lib\js-yaml\loader.js:1591:10)
at Object.yamlParse [as parse] (C:\Users\dolezalc\AppData\Roaming\npm-cache_npx\56432\node_modules\swagger-diff\node_modules\json-schema-ref-parser\lib\yaml.js:20:19)
at parse (C:\Users\dolezalc\AppData\Roaming\npm-cache_npx\56432\node_modules\swagger-diff\node_modules\json-schema-ref-parser\lib\parse.js:26:21)
at C:\Users\dolezalc\AppData\Roaming\npm-cache_npx\56432\node_modules\swagger-diff\node_modules\json-schema-ref-parser\lib\read.js:70:23

JSON output of swagger-diff -i

Hi, thanks for your fantastic tool, first of all!
Small question from my side: I'd like to use this tool from another tool, that would expect that output of

swagger-diff -i old.yaml new.yaml

would be json formatted.
I believe there's no way to control that right now? Is it something that makes sense?
I'm unfortunately not a ruby developer, and can't contribute with PR :(

Cheers

Diff fails on identical or very similar schemas

Hello,

I'm getting a failure when comparing two schemas that are identical or very similar.

I'm attaching two schemas that are very similar: swagger1.json and swagger2.json
I've tried running the following commands:
1) swagger-diff swagger1.json swagger1.json
2) swagger-diff swagger1.json swagger2.json

In both cases I'm getting a following error:
"C:/Ruby21/lib/ruby/gems/2.1.0/gems/swagger-diff-1.0.5/lib/swagger/diff/specifica
tion.rb:109:in schema': undefined methodallOf' for nil:NilClass (NoMethodErro
r)'

swaggerFiles.zip

swagger-diff confused with two operations with same number of parameters

I am getting this error after running swagger-diff against an unchanged resource

API specification for configurator service has changed in an incompatible way: - incompatible request     params
  - get /employers/{}
  - new required request param: key
  - missing request param: id (in: path, type: integer) 

I believe it's because this resource has two GET methods each with a single parameter:

@GET
@Path("{id: [1-9]\\d*}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "If successful, returns an employee with the given id.",
              response = Employer.class)
public Employer getEmployerById(@PathParam("id") long id ){
    return employerRepository.findById(id);
}

@GET
@Path("{key: \\D[\\w]+}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "If successful, returns an employee with the given key.",
              response = Employer.class)
public Employer getEmployerByKey(@PathParam("key") String key ){
    return employerRepository.findByKey(key);
}

The swagger JSON looks like this:

"/employers/{key}": {
  "get": {
    "responses": {
      "200": {
        "schema": {
          "$ref": "#/definitions/Employer"
        },
        "description": "successful operation"
      }
    },
    "parameters": [
      {
        "pattern": "\\D[\\w]+",
        "type": "string",
        "required": true,
        "in": "path",
        "name": "key"
      }
    ],
    "produces": [
      "application/json"
    ],
    "operationId": "getEmployerByKey",
    "description": "",
    "summary": "If successful, returns an employee with the given key.",
    "tags": [
      "employers"
    ]
  }
},
"/employers/{id}": {
  "get": {
    "responses": {
      "200": {
        "schema": {
          "$ref": "#/definitions/Employer"
        },
        "description": "successful operation"
      }
    },
    "parameters": [
      {
        "format": "int64",
        "pattern": "[1-9]\\d*",
        "type": "integer",
        "required": true,
        "in": "path",
        "name": "id"
      }
    ],
    "produces": [
      "application/json"
    ],
    "operationId": "getEmployerById",
    "description": "",
    "summary": "If successful, returns an employee with the given id.",
    "tags": [
      "employers"
    ]
  }
},

NoMethodError: undefined method 'each' for nil:NilClass when processing swagger.json

Here is the full exception. I am attaching the offending json

NoMethodError:         NoMethodError: undefined method `each' for nil:NilClass
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:135:in `properties'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:102:in `refs'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:117:in `nested'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:125:in `properties_for_ref'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:137:in `block in properties'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:135:in `each'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:135:in `properties'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:102:in `refs'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:117:in `nested'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:125:in `properties_for_ref'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:137:in `block in properties'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:135:in `each'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:135:in `properties'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:102:in `refs'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:186:in `block in response_attributes_inner'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:177:in `each'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:177:in `response_attributes_inner'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:28:in `block in response_attributes'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:27:in `each'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/specification.rb:27:in `response_attributes'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:117:in `block in incompatible_response_attributes_enumerator'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:142:in `each'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:142:in `each'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:142:in `each'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:142:in `none?'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:142:in `responses_compatible?'
/Users/dvancouvering/Projects/Ventana/ventana/vendor/swagger-diff/lib/swagger/diff/diff.rb:10:in `compatible?'
/Users/dvancouvering/Projects/Ventana/ventana/test/compatibility/soa_compatibility_test.rb:33:in `block (2 levels) in <class:SoaCompatibilityTest>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.