Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unique and nullable #1459

Open
xibriz opened this issue Nov 19, 2021 · 1 comment
Open

unique and nullable #1459

xibriz opened this issue Nov 19, 2021 · 1 comment

Comments

@xibriz
Copy link

xibriz commented Nov 19, 2021

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
@PatrickOBrien06
Copy link

Could it be possible to remove the unique value and run the a check the application's logic?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants