cyprieng / swagger-parser

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

$ref not working on array definitions #18

Closed c-martinez closed 8 years ago

c-martinez commented 8 years ago

Using the Pet Store example yaml, tried the following:

from swagger_parser import SwaggerParser
SwaggerParser(swagger_path='petstore.yaml')

and got the following error:

.../swagger_parser/swagger_parser.pyc in build_one_definition_example(self, def_name)
     99 
    100         # Get properties example value
--> 101         for prop_name, prop_spec in def_spec['properties'].items():
    102             example = self.get_example_from_prop_spec(prop_spec)
    103             if example is not None:

KeyError: 'properties'

It seems like the parser expects 'properties' to be present, which is not the case for Pets on the Pet store example.

cyprieng commented 8 years ago

Fixed by #19