Trax-air / swagger-tester

Automatically test your swagger API
MIT License
104 stars 36 forks source link

Documentation needs some updating. Troubles running test. #39

Closed ecobos closed 7 years ago

ecobos commented 7 years ago

The documentation does not completely explain how to use the tool. I'm more than happy to update the documentation but I'm having troubles running even the example. I tried using python 2.7 and 3.5 with similar results.

from swagger_tester import swagger_test

authorize_error = {
  'post': {
    '/test': ['405', '404']
  }
}

swagger_test('path-to-my-api.yaml', authorize_error=authorize_error)

The .yaml file exists. I tried both a relative path and absolute path to an actual valid swagger spec file. Documentation does not specify what is required.

The error I keep getting:

Traceback (most recent call last):
  File "swagswag.py", line 15, in <module>
    swagger_test('path-to-my-api.yaml', authorize_error=authorize_error)
  File "/Library/Python/2.7/site-packages/swagger_tester/swagger_tester.py", line 212, in swagger_test
    use_example=use_example):
  File "/Library/Python/2.7/site-packages/swagger_tester/swagger_tester.py", line 248, in swagger_test_yield
    app.add_api(os.path.basename(swagger_yaml_path))
  File "/Library/Python/2.7/site-packages/connexion/app.py", line 149, in add_api
    debug=self.debug)
  File "/Library/Python/2.7/site-packages/connexion/api.py", line 109, in __init__
    validate_spec(spec)
  File "/Library/Python/2.7/site-packages/swagger_spec_validator/validator20.py", line 88, in validate_spec
    validate_apis(apis, bound_deref)
  File "/Library/Python/2.7/site-packages/swagger_spec_validator/validator20.py", line 151, in validate_apis
    oper_params = deref(oper_body.get('parameters', []))
AttributeError: 'str' object has no attribute 'get'

I tried trusty ol' google but all points back to the same docs. Any assistance is appreciated.

cyprieng commented 7 years ago

It looks like an error with connexion (https://github.com/zalando/connexion). Can you send me the yaml file, so I can try to reproduce the bug ?