karthiks3000 / postman-doc-gen

Generate API documentation from a postman collection
MIT License
254 stars 45 forks source link

Error: 'str' object has no attribute 'get' #18

Closed sviluppatoreLaRegione closed 1 year ago

sviluppatoreLaRegione commented 3 years ago

I get this error:

$ ./postman_doc_gen ./api.test.postman_collection.json -o ./api-docs
Traceback (most recent call last):
  File "postman_doc_gen.py", line 29, in <module>
  File "document_generator.py", line 63, in generate_doc
  File "document_generator.py", line 204, in add_items
  File "document_generator.py", line 220, in add_apis
  File "document_generator.py", line 347, in get_body
  File "document_generator.py", line 359, in get_key_values
AttributeError: 'str' object has no attribute 'get'
[31954] Failed to execute script postman_doc_gen
karthiks3000 commented 3 years ago

@sviluppatoreLaRegione can you provide a sample collection to reproduce the error?

sviluppatoreLaRegione commented 3 years ago

Check here https://gist.github.com/sviluppatoreLaRegione/5a0d14cf2ebec961631bbed89d06f03c This is the same collection that I used.

rudyzeinoun commented 3 years ago

You are probably using an old Postman version that is exporting the JSON file in Postman v2.0 format. Upgrade to the latest version of Postman and export using v2.1 format.

sviluppatoreLaRegione commented 3 years ago

@rudyzeinoun if you check my JSON you can see that version is 2.1

ctrlsam commented 2 years ago

I'm getting this too

tudor33sud commented 2 years ago

Same here on v2.1 collection

l-tree commented 5 months ago

I was getting a similar error using the version 2.0 export, which was resolved when I used version 2.1.

The original error: [26200] Failed to execute script postman_doc_gen Traceback (most recent call last): File "postman_doc_gen.py", line 29, in <module> File "document_generator.py", line 63, in generate_doc File "document_generator.py", line 204, in add_items File "document_generator.py", line 233, in add_apis AttributeError: 'str' object has no attribute 'get'