diff --git a/openapi_core/schema/schemas/models.py b/openapi_core/schema/schemas/models.py index 7353dd0..49cd680 100644 --- a/openapi_core/schema/schemas/models.py +++ b/openapi_core/schema/schemas/models.py @@ -42,6 +42,7 @@ class Schema(object): STRING_FORMAT_CALLABLE_GETTER = { SchemaFormat.NONE: Format(text_type, TypeValidator(text_type)), + SchemaFormat.PASSWORD: Format(text_type, TypeValidator(text_type)), SchemaFormat.DATE: Format( format_date, TypeValidator(date, exclude=datetime)), SchemaFormat.DATETIME: Format(format_datetime, TypeValidator(datetime)), diff --git a/tests/unit/schema/test_schemas.py b/tests/unit/schema/test_schemas.py index b66dad7..61e0d19 100644 --- a/tests/unit/schema/test_schemas.py +++ b/tests/unit/schema/test_schemas.py @@ -66,6 +66,14 @@ class TestSchemaUnmarshal(object): assert result == value + def test_string_format_password(self): + schema = Schema(SchemaType.STRING, schema_format=SchemaFormat.PASSWORD) + value = 'password' + + result = schema.unmarshal(value) + + assert result == 'password' + def test_string_float_invalid(self): schema = Schema('string') value = 1.23