mirror of
https://github.com/correl/openapi-core.git
synced 2024-11-22 03:00:10 +00:00
Accepting uuid string format and validating accordingly.
This commit is contained in:
parent
922fce4085
commit
dadf075670
2 changed files with 4 additions and 1 deletions
|
@ -25,3 +25,4 @@ class SchemaFormat(Enum):
|
|||
DATE = 'date'
|
||||
DATETIME = 'date-time'
|
||||
PASSWORD = 'password'
|
||||
UUID = 'uuid'
|
||||
|
|
|
@ -8,6 +8,7 @@ import re
|
|||
import warnings
|
||||
|
||||
from six import iteritems, integer_types, binary_type, text_type
|
||||
from uuid import UUID
|
||||
|
||||
from openapi_core.extensions.models.factories import ModelFactory
|
||||
from openapi_core.schema.schemas.enums import SchemaFormat, SchemaType
|
||||
|
@ -46,6 +47,7 @@ class Schema(object):
|
|||
SchemaFormat.DATE: Format(format_date, TypeValidator(date, exclude=datetime)),
|
||||
SchemaFormat.DATETIME: Format(format_datetime, TypeValidator(datetime)),
|
||||
SchemaFormat.BINARY: Format(binary_type, TypeValidator(binary_type)),
|
||||
SchemaFormat.UUID: Format(UUID, TypeValidator(UUID)),
|
||||
}
|
||||
|
||||
TYPE_VALIDATOR_CALLABLE_GETTER = {
|
||||
|
@ -54,7 +56,7 @@ class Schema(object):
|
|||
SchemaType.INTEGER: TypeValidator(integer_types, exclude=bool),
|
||||
SchemaType.NUMBER: TypeValidator(integer_types, float, exclude=bool),
|
||||
SchemaType.STRING: TypeValidator(
|
||||
text_type, date, datetime, binary_type),
|
||||
text_type, date, datetime, binary_type, UUID),
|
||||
SchemaType.ARRAY: TypeValidator(list, tuple),
|
||||
SchemaType.OBJECT: AttributeValidator('__dict__'),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue