parent
5bdce56bba
commit
7098f45aac
|
|
@ -283,6 +283,10 @@ def find_regex(regex_field):
|
||||||
regex_validator = None
|
regex_validator = None
|
||||||
for validator in regex_field.validators:
|
for validator in regex_field.validators:
|
||||||
if isinstance(validator, validators.RegexValidator):
|
if isinstance(validator, validators.RegexValidator):
|
||||||
|
if isinstance(validator, validators.URLValidator) or validator == validators.validate_ipv4_address:
|
||||||
|
# skip the default url and IP regexes because they are complex and unhelpful
|
||||||
|
# validate_ipv4_address is a RegexValidator instance in Django 1.11
|
||||||
|
continue
|
||||||
if regex_validator is not None:
|
if regex_validator is not None:
|
||||||
# bail if multiple validators are found - no obvious way to choose
|
# bail if multiple validators are found - no obvious way to choose
|
||||||
return None # pragma: no cover
|
return None # pragma: no cover
|
||||||
|
|
@ -428,8 +432,7 @@ def get_basic_type_info(field):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
pattern = None
|
pattern = None
|
||||||
if swagger_type == openapi.TYPE_STRING and format != openapi.FORMAT_URI:
|
if swagger_type == openapi.TYPE_STRING:
|
||||||
# uri skipped because default URLField regex is complex and unhelpful
|
|
||||||
pattern = find_regex(field)
|
pattern = find_regex(field)
|
||||||
|
|
||||||
limits = find_limits(field)
|
limits = find_limits(field)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue