Do not set pattern on non-string values

Fixes #68
This commit is contained in:
Cristi Vîjdea
2018-02-23 18:51:55 +02:00
parent 058fd7096d
commit b38d3e6805
3 changed files with 9 additions and 3 deletions
+4 -1
View File
@@ -361,7 +361,10 @@ def get_basic_type_info(field):
else: # pragma: no cover
return None
pattern = find_regex(field) if format in (None, openapi.FORMAT_SLUG) else None
pattern = None
if swagger_type == openapi.TYPE_STRING and format in (None, openapi.FORMAT_SLUG):
pattern = find_regex(field)
limits = find_limits(field)
result = OrderedDict([