我该怎么做类型或类型。字符串或整数?
How do i do an type OR Type. String OR Int?
我希望能够在字段中允许字符串或整数。我该怎么做?
这是我当前的架构:
'minSize': {'type': 'any'},
我引用 docs:
A list of types can be used to allow different values
>>> v.schema = {'quotes': {'type': ['string', 'list']}}
>>> v.validate({'quotes': 'Hello world!'})
True
>>> v.validate({'quotes': ['Do not disturb my circles!', 'Heureka!']})
True
我希望能够在字段中允许字符串或整数。我该怎么做?
这是我当前的架构:
'minSize': {'type': 'any'},
我引用 docs:
A list of types can be used to allow different values
>>> v.schema = {'quotes': {'type': ['string', 'list']}}
>>> v.validate({'quotes': 'Hello world!'})
True
>>> v.validate({'quotes': ['Do not disturb my circles!', 'Heureka!']})
True