myoperator / swagman

A Postman to swagger api converter using openAPI v3
4 stars 1 forks source link

python error: ypeError: 'pmrequest' object is not subscriptable #19

Open sgperlman opened 3 years ago

sgperlman commented 3 years ago

I'm trying to use swagman for the first time. Everything from requirements.txt has been installed (and confirmed to have been installed).

When I try to run against an exported postman collection, I'm getting the following error:

Traceback (most recent call last): File "run.py", line 32, in cli() File "D:\Users\sgperlman\AppData\Roaming\Python\Python37\site-packages\click\core.py", line 764, in call return self.main(args, kwargs) File "D:\Users\sgperlman\AppData\Roaming\Python\Python37\site-packages\click\core.py", line 717, in main rv = self.invoke(ctx) File "D:\Users\sgperlman\AppData\Roaming\Python\Python37\site-packages\click\core.py", line 956, in invoke return ctx.invoke(self.callback, ctx.params) File "D:\Users\sgperlman\AppData\Roaming\Python\Python37\site-packages\click\core.py", line 555, in invoke return callback(args, **kwargs) File "run.py", line 25, in cli swagger_output = converter.convert(format) File "D:\Users\sgperlman\OneDrive - US Electrical Services, Inc\My Documents\BitBucketRepos\swagman\swagman\convert.py", line 34, in convert spec = self._mapper(spec, parser) File "D:\Users\sgperlman\OneDrive - US Electrical Services, Inc\My Documents\BitBucketRepos\swagman\swagman\convert.py", line 50, in _mapper spec.add_item(item) File "D:\Users\sgperlman\OneDrive - US Electrical Services, Inc\My Documents\BitBucketRepos\swagman\swagman\spec.py", line 240, in add_item operations = self.get_operations(item) File "D:\Users\sgperlman\OneDrive - US Electrical Services, Inc\My Documents\BitBucketRepos\swagman\swagman\spec.py", line 158, in get_operations camelizeKey = PostmanParser.camelize(item['request'].getPathNormalised()) TypeError: 'pmrequest' object is not subscriptable

adamhospodka commented 2 months ago

Same for me.

My setup:

My steps

  1. git clone
  2. install dependencies
  3. python run.py ...
Traceback (most recent call last):
  File "/Users/admin/git/swagman/run.py", line 32, in <module>
    cli()
  File "/opt/homebrew/Caskroom/miniconda/base/envs/conda_python_2/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/conda_python_2/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/conda_python_2/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/conda_python_2/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/admin/git/swagman/run.py", line 25, in cli
    swagger_output = converter.convert(format)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/admin/git/swagman/swagman/convert.py", line 34, in convert
    spec = self._mapper(spec, parser)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/admin/git/swagman/swagman/convert.py", line 50, in _mapper
    spec.add_item(item)
  File "/Users/admin/git/swagman/swagman/spec.py", line 240, in add_item
    operations = self.get_operations(item)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/admin/git/swagman/swagman/spec.py", line 158, in get_operations
    camelizeKey = PostmanParser.camelize(item['request'].getPathNormalised())
                                         ~~~~^^^^^^^^^^^
TypeError: 'pmrequest' object is not subscriptable