swagger_to_uml icon indicating copy to clipboard operation
swagger_to_uml copied to clipboard

Handling allOf for Dog and Cat types of Pet

Open cfaurer opened this issue 5 years ago • 0 comments

Extended Pet example to include Cat and Dog using allOf example from here: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md

Get the following error:

`python swagger_to_uml.py swagger.json > swagger.puml required key "type" not found in dictionary {"description": "A representation of a cat", "allOf": [{"$ref": "#/definitions/Pet"}, {"type": "object", "properties": {"huntingSkill": {"type": "string", "description": "The measured skill for hunting", "default": "lazy", "enum": ["clueless", "lazy", "adventurous", "aggressive"]}}, "required": ["huntingSkill"]}]} Traceback (most recent call last): File "swagger_to_uml.py", line 380, in sw = Swagger.from_file(input_file_name) File "swagger_to_uml.py", line 367, in from_file return Swagger.from_dict(loader(fd)) File "swagger_to_uml.py", line 357, in from_dict definitions = [Definition.from_dict(name, definition) for name, definition in d.get('definitions',{}).items()] File "swagger_to_uml.py", line 357, in definitions = [Definition.from_dict(name, definition) for name, definition in d.get('definitions',{}).items()] File "swagger_to_uml.py", line 204, in from_dict type=d['type'], KeyError: 'type'

Modified swagger attached

swagger.json.txt

cfaurer avatar Mar 21 '19 20:03 cfaurer