X Tutup
The Wayback Machine - https://web.archive.org/web/20201029105825/https://github.com/directus/api/pull/1979
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

Fix validation of the fields: If no fields are given, default should be to validate all fields #1979

Open
wants to merge 1 commit into
base: master
from

Conversation

@arboehme
Copy link
Contributor

@arboehme arboehme commented Sep 2, 2020

Hi, I had the problem, that the fields, which are marked as "required" were neither validated by creation of item nor by the update, if for example the text input was cleared again (Version: 8.8.1)

After some debugging, I've found out, that the fields which were empty on ui (e.g. on create screen) were not send to the backend. The backend on the other hand didn't consider than these fields to be validated, because there was no list of constraints to be checked for these fields ($columnsToValidate in the validatePayload method)

I could fix the errors, as I replaced the default value of this variable to be all fields of the collection. From my point of view during the validation all constraints (Requirement is implemented as one of the constraints as I understand) should be considered, if no fields are provided (which is the case for all calls from ItemService for example)

Please note: since I'm was not able to find open issues regarding the validation as whole, I'm something wondering, that such essential functionality didn't work for me. So I would like to ask the core team to check this before merge in the master branch.

Thank you and best regards

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

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.
X Tutup