json: handle uuid string format
This commit is contained in:
parent
37b59d1d3b
commit
e8f25d6f0c
1 changed files with 3 additions and 0 deletions
|
@ -298,6 +298,9 @@ class SchemaConverter:
|
||||||
elif schema_type in (None, 'string') and 'pattern' in schema:
|
elif schema_type in (None, 'string') and 'pattern' in schema:
|
||||||
return self._visit_pattern(schema['pattern'], rule_name)
|
return self._visit_pattern(schema['pattern'], rule_name)
|
||||||
|
|
||||||
|
elif schema_type in (None, 'string') and re.match(r'^uuid[1-5]?$', schema.get('format', '')):
|
||||||
|
return self._visit_pattern('^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$', 'uuid')
|
||||||
|
|
||||||
elif schema_type == 'object' and len(schema) == 1 or schema_type is None and len(schema) == 0:
|
elif schema_type == 'object' and len(schema) == 1 or schema_type is None and len(schema) == 0:
|
||||||
# This depends on all primitive types
|
# This depends on all primitive types
|
||||||
for t, r in PRIMITIVE_RULES.items():
|
for t, r in PRIMITIVE_RULES.items():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue