Merge "Don't add MaxStrLen validator if AllowedValues applied"

This commit is contained in:
Jenkins 2017-07-05 08:57:53 +00:00 committed by Gerrit Code Review
commit fb8d17bc6b
2 changed files with 3 additions and 5 deletions

View File

@ -122,7 +122,9 @@ class Field(object):
if issubclass(self.field_class, fields.StringField):
# check if fields is string
if not any(isinstance(v, val_lib.MaxStrLen)
for v in self.validators):
for v in self.validators) and \
not any(isinstance(v, val_lib.AllowedValues)
for v in self.validators):
default.append(val_lib.MaxStrLen(255))
return default

View File

@ -144,7 +144,6 @@ fixture_base_props = {
u'enum': [u'private', u'public'],
u'filter_ops': [u'eq', u'neq', u'in'],
u'glareType': u'String',
u'maxLength': 255,
u'sortable': True,
u'type': u'string'}
}
@ -621,7 +620,6 @@ fixtures = {
u'neq',
u'in'],
u'glareType': u'String',
u'maxLength': 255,
u'type': [u'string',
u'null']}
}),
@ -658,7 +656,6 @@ fixtures = {
u'neq',
u'in'],
u'glareType': u'String',
u'maxLength': 255,
u'type': [u'string',
u'null']},
@ -678,7 +675,6 @@ fixtures = {
u'neq',
u'in'],
u'glareType': u'String',
u'maxLength': 255,
u'type': [u'string', u'null']},
u'image': {u'additionalProperties': False,
u'description': u'Image binary.',