Validating an array against the empty schema {} gives KeyError: 'items'. A git bisect shows this was introduced by commit 35f8e28157ca5d2f1ddd9f5684c4e6c0ddf75d6c (#318).
Traceback (most recent call last):
File "/home/anders/.cache/pypoetry/virtualenvs/openapi-core-XEMBi3Y7-py3.9/lib/python3.9/site-packages/dictpath/paths.py", line 138, in open
yield self._content_cached
AttributeError: 'SpecPath' object has no attribute '_content_cached'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/anders/python/openapi-core/items-bug.py", line 27, in <module>
response_validator.validate(request, response)
File "/home/anders/python/openapi-core/openapi_core/validation/response/validators.py", line 185, in validate
data, data_errors = self._get_data(response, operation_response)
File "/home/anders/python/openapi-core/openapi_core/validation/response/validators.py", line 76, in _get_data
data = self._unmarshal(schema, casted)
File "/home/anders/python/openapi-core/openapi_core/validation/validators.py", line 74, in _unmarshal
return unmarshaller(value)
File "/home/anders/python/openapi-core/openapi_core/unmarshalling/schemas/unmarshallers.py", line 48, in __call__
return self.unmarshal(value)
File "/home/anders/python/openapi-core/openapi_core/unmarshalling/schemas/unmarshallers.py", line 295, in unmarshal
return unmarshaller(value)
File "/home/anders/python/openapi-core/openapi_core/unmarshalling/schemas/unmarshallers.py", line 168, in __call__
return list(map(self.items_unmarshaller, value))
File "/home/anders/python/openapi-core/openapi_core/unmarshalling/schemas/unmarshallers.py", line 162, in items_unmarshaller
return self.unmarshallers_factory.create(self.schema / "items")
File "/home/anders/python/openapi-core/openapi_core/unmarshalling/schemas/factories.py", line 60, in create
if schema.getkey("deprecated", False):
File "/home/anders/.cache/pypoetry/virtualenvs/openapi-core-XEMBi3Y7-py3.9/lib/python3.9/site-packages/dictpath/paths.py", line 128, in getkey
with self.open() as d:
File "/nix/store/dn4fwp0yx6nsa85cr20cwvdmg64xwmcy-python3-3.9.9/lib/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/home/anders/.cache/pypoetry/virtualenvs/openapi-core-XEMBi3Y7-py3.9/lib/python3.9/site-packages/dictpath/paths.py", line 140, in open
with self._open() as content:
File "/nix/store/dn4fwp0yx6nsa85cr20cwvdmg64xwmcy-python3-3.9.9/lib/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/home/anders/python/openapi-core/openapi_core/spec/accessors.py", line 15, in open
content = content[part]
KeyError: 'items'
Validating an array against the empty schema
{}
givesKeyError: 'items'
. Agit bisect
shows this was introduced by commit 35f8e28157ca5d2f1ddd9f5684c4e6c0ddf75d6c (#318).