Add field option for "unique or null" #2072
Replies: 4 comments 4 replies
-
I'm not sure what use-cases exist for the "null can exist once" option. It would seem to me that if unique is true and required is false it should imply "unique or null". |
Beta Was this translation helpful? Give feedback.
-
Instead of {
uniqueOrNull: true,
required: false
} Might be better to have {
unique: {
allowNulls: true
},
required: false
} This retains backwards compatibility with current versions, but adds the new feature without needing a new property. A later major version could remove the backwards compact and switch it to |
Beta Was this translation helpful? Give feedback.
-
It would be sooooo useful to have tbh; is it anywhere on the roadmap yet? |
Beta Was this translation helpful? Give feedback.
-
This is definitely needed. I've hit a roadblock while working on my website because of this. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Sometimes a piece of data can be optional, but if it is filled in, it must be unique.
Unique and required
Unique and not required: null can exist once
Unique or null: null can exist multiple times
Beta Was this translation helpful? Give feedback.
All reactions