MarketSquare / roboswag

Apache License 2.0
26 stars 2 forks source link

Roboswag not running while using other than the example file #36

Closed terezachudobova closed 2 years ago

terezachudobova commented 2 years ago

Dear authors, I've also encountered an issue while running roboswag -s using a path to a swagger file used within our company. The version of OpenAPI specification is v2, so hopefully the .json file should be supported by roboswag. Please see the stackTrace below:

Traceback (most recent call last):
  File "C:\Program Files\Python397\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python397\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\cen69317\AppData\Roaming\Python\Python39\Scripts\roboswag.exe\__main__.py", line 7, in <module>
  File "C:\Users\cen69317\AppData\Roaming\Python\Python39\site-packages\roboswag\__main__.py", line 27, in run_roboswag
    generate_cli()
  File "C:\Users\cen69317\AppData\Roaming\Python\Python39\site-packages\roboswag\__main__.py", line 23, in generate_cli
    generate(args.spec)
  File "C:\Users\cen69317\AppData\Roaming\Python\Python39\site-packages\roboswag\generate\generate.py", line 13, in generate
    api_model, swagger = APIModelCreator.from_prance(source)
  File "C:\Users\cen69317\AppData\Roaming\Python\Python39\site-packages\roboswag\generate\models\api.py", line 123, in from_prance
    api_model.parse_swagger(swagger)
  File "C:\Users\cen69317\AppData\Roaming\Python\Python39\site-packages\roboswag\generate\models\api.py", line 27, in parse_swagger
    self.parse_definitions(swagger)
  File "C:\Users\cen69317\AppData\Roaming\Python\Python39\site-packages\roboswag\generate\models\api.py", line 96, in parse_definitions
    for prop_name, prop_body in def_body.get("properties", []).items():
AttributeError: 'list' object has no attribute 'items'

I'll be happy to send you the file in case you would be open to look into this.

Thank you for your effort, Tereza Chudobová

bhirsz commented 2 years ago

Thanks for testing the tool - it could be possible that the spec file allow two types for some fields where we expect one (in this case we expect dict but we get list). If you can send me the file it would help me a lot - there could be other issues as well so we could work on getting roboswag to work on your test file while improving the tool. (if you can't share it, you can do it using my email bartek.hirsz@gmail.com).

terezachudobova commented 2 years ago

The file was sent to your email, thank you for the superb approach! Tereza