cyprieng / swagger-parser

Give useful informations about your swagger files
MIT License
62 stars 59 forks source link

AttributeError exception in _get_example_from_properties() when object has no properties field #40

Closed mtherieau closed 7 years ago

mtherieau commented 7 years ago

in cases where there is no properties field (e.g. properties are specified via additionalProperties) then _get_example_from_properties() throws an AttributeError exception, like so:

https://travis-ci.org/Trax-air/swagger-parser/jobs/214411452#L643

Test case added in: https://github.com/Trax-air/swagger-parser/pull/39 an example of this issue is in file: tests/no_properties.yaml

https://github.com/Trax-air/swagger-parser/pull/39/commits/c80700d78111a4723e11ff56c25e4e5d5d56a707#diff-0d3c37b4c72efec5a9a3a1bde3230a16

The fix is part of same PR, here: https://github.com/Trax-air/swagger-parser/pull/39/commits/a191fb3dba21f1d8f1084970802a2dcaf57057c5