mirror of
https://github.com/correl/openapi-core.git
synced 2024-11-24 11:09:54 +00:00
13e65a2d91
`password` is a valid OpenAPIv3 string format, that is used as a UI hint for frontend clients to mask the input field. It was already present in the `SchemaFormat` enum, but it was not handled in `_unmarshal_string` that uses `STRING_FORMAT_CALLABLE_GETTER` to decide how to unmarshal a string, which would result in an error like this one: ``` Traceback (most recent call last): [... snip ...] File ".venv/lib/python3.7/site-packages/openapi_core/validation/request/validators.py", line 37, in validate body, body_errors = self._get_body(request, operation) File ".venv/lib/python3.7/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.7/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.7/site-packages/openapi_core/schema/schemas/models.py", line 189, in unmarshal casted = self.cast(value, custom_formatters=custom_formatters, strict=strict) File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 179, in cast return cast_callable(value) File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 295, in _unmarshal_object value, custom_formatters=custom_formatters) File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 335, in _unmarshal_properties prop_value, custom_formatters=custom_formatters) File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 189, in unmarshal casted = self.cast(value, custom_formatters=custom_formatters, strict=strict) File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 179, in cast return cast_callable(value) File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 295, in _unmarshal_object value, custom_formatters=custom_formatters) File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 335, in _unmarshal_properties prop_value, custom_formatters=custom_formatters) File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 189, in unmarshal casted = self.cast(value, custom_formatters=custom_formatters, strict=strict) File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 179, in cast return cast_callable(value) File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 215, in _unmarshal_string formatstring = self.STRING_FORMAT_CALLABLE_GETTER[schema_format] KeyError: <SchemaFormat.PASSWORD: 'password'> ``` |
||
---|---|---|
.. | ||
test_operations.py | ||
test_parameters.py | ||
test_paths.py | ||
test_request_bodies.py | ||
test_schemas.py | ||
test_schemas_registry.py | ||
test_specs.py |