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

Can't prevent empty csv / json #23306

Open
Dominic-Marcelino opened this issue Aug 12, 2024 · 1 comment
Open

Can't prevent empty csv / json #23306

Dominic-Marcelino opened this issue Aug 12, 2024 · 1 comment

Comments

@Dominic-Marcelino
Copy link
Contributor

Describe the Bug

When adding a CSV-field we currently can't prevent empty fields. Even if we set 'not-null' to true, it's still possible to create empty entries.
This happens for csv (=text) as well as json (=array) fields.

To Reproduce

  1. create a field test as csv, do not allow null-values, default-value is automatically set to null
  2. Create an entry with a value
  3. delete the value & save again
  4. --> it's inserted as "empty" instead of null and therewith valid

Even with custom validations it seems not to be possible to prevent empty json / csv.

For json it's somehow related to #7277 but as csv are stored as strings I'd expect it to work

Directus Version

10.12.1

Hosting Strategy

Self-Hosted (Docker Image)

Database

Postgres

@rijkvanzanten
Copy link
Member

Hmm yeah. Empty and null are technically two different things, but this is indeed a bit confusing. In case of a csv, the _nempty validation operation should prevent it from being an empty string though. For JSON there's currently no "length" for arrays indeed

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

No branches or pull requests

2 participants