Skip to content

KeyError: <SchemaFormat.BYTE: 'byte'> #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mnboos opened this issue Feb 26, 2019 · 0 comments
Closed

KeyError: <SchemaFormat.BYTE: 'byte'> #110

mnboos opened this issue Feb 26, 2019 · 0 comments

Comments

@mnboos
Copy link

mnboos commented Feb 26, 2019

We encounter the following error because we use a string property with format 'byte' (for base64 strings, according to the OpenAPI specification (https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#data-types).

The properties part of the OpenAPI schema looks like this:

"properties": {
	"data": {
		"type": "string",
		"format": "byte"
	}
  File "/venv/lib/python3.6/site-packages/openapi_core/validation/request/validators.py", line 37, in validate
    body, body_errors = self._get_body(request, operation)
  File "/venv/lib/python3.6/site-packages/openapi_core/validation/request/validators.py", line 82, in _get_body
    body = media_type.unmarshal(raw_body, self.custom_formatters)
  File "/venv/lib/python3.6/site-packages/openapi_core/schema/media_types/models.py", line 45, in unmarshal
    unmarshalled = self.schema.unmarshal(deserialized, custom_formatters=custom_formatters)
  File "/venv/lib/python3.6/site-packages/openapi_core/schema/schemas/models.py", line 183, in unmarshal
    casted = self.cast(value, custom_formatters=custom_formatters)
  File "/venv/lib/python3.6/site-packages/openapi_core/schema/schemas/models.py", line 173, in cast
    return cast_callable(value)
  File "/venv/lib/python3.6/site-packages/openapi_core/schema/schemas/models.py", line 263, in _unmarshal_object
    value, custom_formatters=custom_formatters)
  File "/venv/lib/python3.6/site-packages/openapi_core/schema/schemas/models.py", line 302, in _unmarshal_properties
    prop_value, custom_formatters=custom_formatters)
  File "/venv/lib/python3.6/site-packages/openapi_core/schema/schemas/models.py", line 183, in unmarshal
    casted = self.cast(value, custom_formatters=custom_formatters)
  File "/venv/lib/python3.6/site-packages/openapi_core/schema/schemas/models.py", line 173, in cast
    return cast_callable(value)
  File "/venv/lib/python3.6/site-packages/openapi_core/schema/schemas/models.py", line 263, in _unmarshal_object
    value, custom_formatters=custom_formatters)
  File "/venv/lib/python3.6/site-packages/openapi_core/schema/schemas/models.py", line 302, in _unmarshal_properties
    prop_value, custom_formatters=custom_formatters)
  File "/venv/lib/python3.6/site-packages/openapi_core/schema/schemas/models.py", line 183, in unmarshal
    casted = self.cast(value, custom_formatters=custom_formatters)
  File "/venv/lib/python3.6/site-packages/openapi_core/schema/schemas/models.py", line 173, in cast
    return cast_callable(value)
  File "/venv/lib/python3.6/site-packages/openapi_core/schema/schemas/models.py", line 206, in _unmarshal_string
    formatstring = self.STRING_FORMAT_CALLABLE_GETTER[schema_format]
KeyError: <SchemaFormat.BYTE: 'byte'>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants