Skip to content

Commit 391d664

Browse files
authored
Merge pull request #132 from niteoweb/fix/password_format
Add support for `password` string format
2 parents f274836 + 13e65a2 commit 391d664

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

openapi_core/schema/schemas/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class Schema(object):
4242

4343
STRING_FORMAT_CALLABLE_GETTER = {
4444
SchemaFormat.NONE: Format(text_type, TypeValidator(text_type)),
45+
SchemaFormat.PASSWORD: Format(text_type, TypeValidator(text_type)),
4546
SchemaFormat.DATE: Format(
4647
format_date, TypeValidator(date, exclude=datetime)),
4748
SchemaFormat.DATETIME: Format(format_datetime, TypeValidator(datetime)),

tests/unit/schema/test_schemas.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ def test_string_format_uuid_uuid_quirks_valid(self):
6666

6767
assert result == value
6868

69+
def test_string_format_password(self):
70+
schema = Schema(SchemaType.STRING, schema_format=SchemaFormat.PASSWORD)
71+
value = 'password'
72+
73+
result = schema.unmarshal(value)
74+
75+
assert result == 'password'
76+
6977
def test_string_float_invalid(self):
7078
schema = Schema('string')
7179
value = 1.23

0 commit comments

Comments
 (0)