directus / directus

The flexible backend for all your projects 🐰 Turn your DB into a headless CMS, admin panels, or apps with a custom UI, instant APIs, auth & more.
https://directus.io
Other
27.16k stars 3.8k forks source link

Custom field validation not being triggered #16319

Open tonyellow opened 1 year ago

tonyellow commented 1 year ago

Describe the Bug

I have a collection with a simple text field. I added a custom validation by editing the text field. It's a simple validation which just checks if the field is empty.

Screenshot 2022-11-04 at 08 57 24

When I add a new item to the collection and leave the text box empty, no validation error is shown.

To Reproduce

see bug

Errors Shown

none

What version of Directus are you using?

9.20.4

What version of Node.js are you using?

v16.18.0

What database are you using?

postgres 15

What browser are you using?

chrome osx

How are you deploying Directus?

local

azrikahar commented 1 year ago

Duplicate of #15899, and it is currently tracked in #14571. Technically custom field validation does work when it is being sent. For example when we set validation as "Description contains abc", it will trigger when we set Description as any string without "abc". However it will not trigger when we do not edit Description, so it was never "sent", which is the crux of #14571 👍

azrikahar commented 1 year ago

After looking into #14571, although validatePayload itself is also causing this field validation to not trigger when a field is not submitted, the fix for #14571 is currently isolated to Flows conditions operation as changes to validatePayload has a larger surface of impact.

Re-opening this to ensure this is still tracked 👍

bhagyesh-7span commented 1 year ago

I tried to reproduce it and i came to know the following

image

image

image

image

image

image

image image

rijkvanzanten commented 1 year ago

Linear: ENG-144

bhagyesh-7span commented 1 year ago

Is this issue now internal team issue ? or is it still available for us to debug @rijkvanzanten ? I tried joining the linear but it shows i don't have access to the workspace ?

br41nslug commented 1 year ago

@bhagyesh-7span You're still free to debug this issue if you want 😄 We've just linked the open issues to our internal issue tracker for better internal planning/tracking