Guard against attempted deletion of inexistent attributes

Fixes #76
This commit is contained in:
Cristi Vîjdea
2018-03-05 19:59:03 +02:00
parent 3d3b7899e5
commit 9ad55bac99
3 changed files with 13 additions and 4 deletions
+2 -2
View File
@@ -356,9 +356,9 @@ class OpenAPISchemaGenerator(object):
view_inspector = view_inspector_cls(view, path, method, components, request, overrides)
operation = view_inspector.get_operation(operation_keys)
if set(operation.consumes) == set(self.consumes):
if 'consumes' in operation and set(operation.consumes) == set(self.consumes):
del operation.consumes
if set(operation.produces) == set(self.produces):
if 'produces' in operation and set(operation.produces) == set(self.produces):
del operation.produces
return operation