Yelp / swagger-spec-compatibility

Python library to check Swagger Spec backward compatibility
https://swagger-spec-compatibility.readthedocs.org
Apache License 2.0
20 stars 8 forks source link

unable to run this tool on any files #17

Closed garyhoren closed 4 years ago

garyhoren commented 4 years ago

Forgive me, I'm not a python programmer so this probably due to my misunderstanding:

I ran pip install git+https://github.com/Yelp/swagger-spec-compatibilityf (first installed the released version and got the same result; the line numbers match the source better in this version), and running it on two very simple yaml files produces:

ansible|ghoren-ltm:Downloads ghoren$ swagger_spec_compatibility run old.yaml new.yaml
Traceback (most recent call last):
  File "/Users/ghoren/.ansible/py3/bin/swagger_spec_compatibility", line 11, in <module>
    load_entry_point('swagger-spec-compatibility==1.2.0', 'console_scripts', 'swagger_spec_compatibility')()
  File "/Users/ghoren/.ansible/py3/lib/python3.6/site-packages/swagger_spec_compatibility/__main__.py", line 17, in main
    exit_code = args.func(args)  # type: int
  File "/Users/ghoren/.ansible/py3/lib/python3.6/site-packages/swagger_spec_compatibility/cli/run.py", line 80, in execute
    rules=rules(cli_args),
  File "/Users/ghoren/.ansible/py3/lib/python3.6/site-packages/swagger_spec_compatibility/rules/__init__.py", line 33, in compatibility_status
    for rule in rules
  File "/Users/ghoren/.ansible/py3/lib/python3.6/site-packages/swagger_spec_compatibility/rules/__init__.py", line 33, in <dictcomp>
    for rule in rules
  File "/Users/ghoren/.ansible/py3/lib/python3.6/site-packages/swagger_spec_compatibility/rules/deleted_endpoint.py", line 30, in validate
    endpoints_left_spec = get_endpoints(left_spec)
TypeError: unhashable type: 'Spec'
ansible|ghoren-ltm:Downloads ghoren$ 

I see that Spec is imported from bravado core, so I uninstalled swagger_spec_compatibility, installed bravado_core, and reinstalled swagger_spec_compatibility. I get the same result.

I'm using python from Ansible version 3.6.5, on Mac Mojave:

ansible|ghoren-ltm:Downloads ghoren$ python --version
Python 3.6.5
ansible|ghoren-ltm:Downloads ghoren$ which python
/Users/ghoren/.ansible/py3/bin/python

What am I not understanding about how to install this?

macisamuele commented 4 years ago

@garyhoren Thanks for reporting this. The error that you're having is already known to the library, travis is red ;(

The error is caused by some changes of bravado-core>=5.16.0.

Until we're not able to fully identify and fix the issue I would recommend to pin bravado-core to before 5.16 release.

edit: bravado-core PR has been opened: https://github.com/Yelp/bravado-core/pull/363 swagger-spec-compatibility PR will be opened soon

garyhoren commented 4 years ago

That got me around this problem. you might consider just updating the install info for swagger-spec-compatibility to explicitly say pip install bravado_core==5.15.0 until the problem is fixed.

Thanks!

macisamuele commented 4 years ago

I'm releasing v1.2.1 that embed the bravado-core limitations into the dependencies definitions.

Going to close this as soon as the new version is released on https://pypi.org