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

Support for undefined as a value for service validators #4534

Merged
merged 4 commits into from
Feb 23, 2022
Merged

Support for undefined as a value for service validators #4534

merged 4 commits into from
Feb 23, 2022

Conversation

realStandal
Copy link
Collaborator

Closes #3979

CC: @jtoar

Summary

Passing undefined to one of the service validators will now function as though having never defined the validator at all.

Letting:

validate('foo', { format: undefined })

Be functionally equivalent to:

validate('foo', {})

As such, it also adds a test which ensures the above (validate('foo', {})) always equates to being "do not validate/throw".

@realStandal realStandal changed the title Rl service validator undefined triggering Support for undefined as a value for service validators Feb 20, 2022
@jtoar jtoar added the release:feature This PR introduces a new feature label Feb 21, 2022
@thedavidprice
Copy link
Contributor

@cannikin is this one you can take a look at?

@cannikin cannikin self-assigned this Feb 22, 2022
@cannikin
Copy link
Member

Awesome, and thanks for the tests!

@thedavidprice thedavidprice merged commit 5d03e29 into redwoodjs:main Feb 23, 2022
@jtoar jtoar added this to the next-release milestone Feb 23, 2022
@realStandal realStandal deleted the rl-service-validator-undefined-triggering branch February 23, 2022 02:18
@thedavidprice thedavidprice modified the milestones: next-release, v0.47.0 Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:feature This PR introduces a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

undefined still causes (presence) validator to trigger
4 participants