unique and nullable
xibriz opened this issue · comments
Ruben Andreassen commented
Expected Behavior
When a field is marked as unique and nullable (optional) I would expect that no duplicate values are allowed except null/None.
A wourkaround could be to omit the default None and omit the field. But would it not make more sense to allow multiple null values?
schema = {
'optional_unique_value': {
'type': 'string',
'default': None,
'unique': True,
'nullable': True,
}
}
Actual Behavior
An error message is given: "value 'None' is not unique"
Environment
- Python version: 3.8.10
- Eve version: 1.1.5
PatrickOB commented
Could it be possible to remove the unique value and run the a check the application's logic?