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

chore: min row validation should pass when the field is not required and no rows are present #4052

Merged
merged 14 commits into from
Nov 10, 2023

Conversation

JessChowdhury
Copy link
Member

@JessChowdhury JessChowdhury commented Nov 8, 2023

Description

Updates field validation to only enforce min rows when a value is present or the field is required (this is what we state in the docs).
Applicable to the following fields: array, blocks, number, relationship.

Closes #3994

  • I have read and understand the CONTRIBUTING.md document in this repository.

Type of change

  • Chore (non-breaking change which does not add functionality)

Checklist:

  • I have added tests that prove my fix is effective or that my feature works
  • Existing test suite passes locally with my changes

@JarrodMFlesch JarrodMFlesch merged commit 803a37e into main Nov 10, 2023
29 checks passed
@JarrodMFlesch JarrodMFlesch deleted the chore/min-rows-validation branch November 10, 2023 17:06
@tyteen4a03
Copy link
Contributor

tyteen4a03 commented Nov 21, 2023

This breaks number validation when the value is a falsy value (i.e. 0).

This line is the culprit: https://github.com/payloadcms/payload/pull/4052/files#diff-64ef6752d148ff573e45c996082e7a299ef5d29e689655e64d96c1955098f42eR210

@JarrodMFlesch
Copy link
Contributor

@tyteen4a03 good catch, that line and the one below it are both problematic, will fix!

@JarrodMFlesch JarrodMFlesch mentioned this pull request Nov 21, 2023
5 tasks
@JarrodMFlesch
Copy link
Contributor

@tyteen4a03 will be fixed by this PR #4233

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

Successfully merging this pull request may close these issues.

Blocks enforce minRows when no data is present
3 participants