parent
3ac6c9ec3a
commit
c5c40e31c4
|
|
@ -262,7 +262,12 @@ def find_regex(regex_field):
|
||||||
regex_validator = validator
|
regex_validator = validator
|
||||||
|
|
||||||
# regex_validator.regex should be a compiled re object...
|
# regex_validator.regex should be a compiled re object...
|
||||||
pattern = getattr(getattr(regex_validator, 'regex', None), 'pattern', None)
|
try:
|
||||||
|
pattern = getattr(getattr(regex_validator, 'regex', None), 'pattern', None)
|
||||||
|
except Exception: # pragma: no cover
|
||||||
|
logger.warning('failed to compile regex validator of ' + str(regex_field), exc_info=True)
|
||||||
|
return None
|
||||||
|
|
||||||
if pattern:
|
if pattern:
|
||||||
# attempt some basic cleanup to remove regex constructs not supported by JavaScript
|
# attempt some basic cleanup to remove regex constructs not supported by JavaScript
|
||||||
# -- swagger uses javascript-style regexes - see https://github.com/swagger-api/swagger-editor/issues/1601
|
# -- swagger uses javascript-style regexes - see https://github.com/swagger-api/swagger-editor/issues/1601
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue