`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'>
```
This is important because it does the correct validation over items that
are restricted in "oneOf", so that it's possible to use schemas that are
superset of one another as items of "oneOf".
Before this change, if a UUID instance got received as value in the
Schema, it was breaking the unmarshal because UUID instances can't be
used as values to instantiate other UUIDs.
Currently if valid swagger syntax is used for model composition an
error will be thrown due to the lack of a type property. This was
corrected by making object the default type.
schema_type = schema_deref.get('type', 'object')
I changed the swagger definition to test for this. Now PetCreate is a
composite of PetCreatePartOne and PetCreatePartTwo. However, this
caused `test_post_pets_empty_body` to fail, which turned out to be a
bug in the required properties.
In `_unmarshal_object` the `get_all_properties` method is called to get
all properties from the subschemas. However, this is not done for
required properties, meaning that only top level required properties
will be correctly validated. I have added a
`get_all_required_properties’ to fix this.
This caused `test_get_pets` to fail. In this case the bug allowed an
incorrect test case to be introduced. Pet requires `id`, but it also
requires name because it inherits from PetCreate. I have fixed this
test case by adding the missing required property.
After these changes `test_get_pet_not_found` failed due to a string
formatting error (double quotes vs single quotes). I fixed this by
switching to dictionary comparisons.