Prevent crash when ViewInspector.get_operation returns None

openapi3
Cristi Vîjdea 2018-05-14 22:10:13 +03:00
parent aca0c4713e
commit a4a11ad1ab
1 changed files with 3 additions and 0 deletions

View File

@ -367,6 +367,9 @@ class OpenAPISchemaGenerator(object):
view_inspector = view_inspector_cls(view, path, method, components, request, overrides)
operation = view_inspector.get_operation(operation_keys)
if operation is None:
return None
if 'consumes' in operation and set(operation.consumes) == set(self.consumes):
del operation.consumes
if 'produces' in operation and set(operation.produces) == set(self.produces):