You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am unable to validate a response that contains an object with a property of a string array. I believe the spec is valid, it validates on the Swagger Editor.
JSON being validated {"myarray": ["val1", "val2"]}
Stack Trace
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/validation/response/validators.py", line 33, in validate
data, data_errors = self._get_data(response, operation_response)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/validation/response/validators.py", line 93, in _get_data
data = self._unmarshal(media_type, casted)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/validation/response/validators.py", line 115, in _unmarshal
param_or_media_type, value, context=UnmarshalContext.RESPONSE,
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/validation/validators.py", line 53, in _unmarshal
return unmarshaller(value)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 264, in call
return unmarshaller(value)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 49, in call
return self.unmarshal(value)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 169, in unmarshal
return self._unmarshal_object(value)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 190, in _unmarshal_object
properties = self._unmarshal_properties(value)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 234, in _unmarshal_properties
prop)(prop_value)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 264, in call
return unmarshaller(value)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 148, in call
return list(map(self.items_unmarshaller, value))
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 143, in items_unmarshaller
return self.unmarshallers_factory.create(self.schema.items)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/factories.py", line 48, in create
raise TypeError("schema not type of Schema")
The text was updated successfully, but these errors were encountered:
@jwfrankl thanks for the report. Spec and schema are valid for sure.
it's an issue with determining type for unmarshaller. Schema type is defined inside allOf schema (stringarray schema) which is not considered in unmarshalling process
I am unable to validate a response that contains an object with a property of a string array. I believe the spec is valid, it validates on the Swagger Editor.
JSON being validated
{"myarray": ["val1", "val2"]}
OpenApi Spec
{ "openapi": "3.0.0", "info": { "description": "Test validator against an array of strings", "title": "Array of strings schema", "version": "1.0" }, "servers": [{ "url": "http://localhost/unitTest" } ], "paths": { "/stringarray": { "get": { "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/stringarrayobject" } ] } } } } } } } }, "components": { "schemas": { "stringarrayobject": { "type": "object", "properties": { "myarray": { "allOf": [{ "$ref": "#/components/schemas/stringarray" } ] } } }, "stringarray": { "type": "array", "items": { "allOf": [{ "maxLength": 255, "type": "string", "description": "Mock content filter" } ] } } } } }
Stack Trace
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/validation/response/validators.py", line 33, in validate
data, data_errors = self._get_data(response, operation_response)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/validation/response/validators.py", line 93, in _get_data
data = self._unmarshal(media_type, casted)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/validation/response/validators.py", line 115, in _unmarshal
param_or_media_type, value, context=UnmarshalContext.RESPONSE,
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/validation/validators.py", line 53, in _unmarshal
return unmarshaller(value)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 264, in call
return unmarshaller(value)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 49, in call
return self.unmarshal(value)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 169, in unmarshal
return self._unmarshal_object(value)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 190, in _unmarshal_object
properties = self._unmarshal_properties(value)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 234, in _unmarshal_properties
prop)(prop_value)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 264, in call
return unmarshaller(value)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 148, in call
return list(map(self.items_unmarshaller, value))
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py", line 143, in items_unmarshaller
return self.unmarshallers_factory.create(self.schema.items)
File "/home/franklij/.pyenv/versions/3.7.0/lib/python3.7/site-packages/openapi_core/unmarshalling/schemas/factories.py", line 48, in create
raise TypeError("schema not type of Schema")
The text was updated successfully, but these errors were encountered: