Use a more generic test for path item object's operations

Get the list of allowed operations from openapi_spec_validator:
b2e439aa79/openapi_spec_validator/validators.py (L157)
This commit is contained in:
Peter Bašista 2018-02-09 19:48:52 +01:00
parent 49c2330810
commit 48dba2c576

View file

@ -4,6 +4,7 @@ import logging
from functools import lru_cache
from six import iteritems
from openapi_spec_validator.validators import PathItemValidator
from openapi_core.exceptions import InvalidResponse
from openapi_core.parameters import ParametersGenerator
@ -56,7 +57,7 @@ class OperationsGenerator(object):
def generate(self, path_name, path):
path_deref = self.dereferencer.dereference(path)
for http_method, operation in iteritems(path_deref):
if http_method.startswith('x-') or http_method == 'parameters':
if http_method not in PathItemValidator.OPERATIONS:
continue
operation_deref = self.dereferencer.dereference(operation)