mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 00:49:49 +03:00
Added comment for why \z
.
This commit is contained in:
parent
29847a123a
commit
e872862a91
|
@ -554,6 +554,8 @@ class AutoSchema(ViewInspector):
|
||||||
if isinstance(v, URLValidator):
|
if isinstance(v, URLValidator):
|
||||||
schema['format'] = 'uri'
|
schema['format'] = 'uri'
|
||||||
if isinstance(v, RegexValidator):
|
if isinstance(v, RegexValidator):
|
||||||
|
# In Python, the token \Z does what \z does in other engines.
|
||||||
|
# https://stackoverflow.com/questions/53283160
|
||||||
schema['pattern'] = v.regex.pattern.replace('\\Z', '\\z')
|
schema['pattern'] = v.regex.pattern.replace('\\Z', '\\z')
|
||||||
elif isinstance(v, MaxLengthValidator):
|
elif isinstance(v, MaxLengthValidator):
|
||||||
attr_name = 'maxLength'
|
attr_name = 'maxLength'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user