fix(frontend): allow null/undefined to pass enum validation for optional operator properties#5676
Open
rbelavadi wants to merge 2 commits into
Open
fix(frontend): allow null/undefined to pass enum validation for optional operator properties#5676rbelavadi wants to merge 2 commits into
rbelavadi wants to merge 2 commits into
Conversation
…r optional fields
Contributor
|
👋 Thanks for your first contribution to Texera, @rbelavadi! If you're looking for a good place to start, browse issues labeled You can drive common housekeeping yourself by commenting one of these commands on its own line:
Each command must match exactly: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Fix enum validator for optional operator properties.
Currently, the validator uses
c.value ?? ""which coerces undefined toempty string, then checks if
""is in the enum. Since empty string isnever a valid enum option, optional fields left blank always fail validation
and show a spurious error to the user.
Replace with
c.value == nullcheck — if the value is unset (null orundefined), the field passes validation. Only run the enum check if the
user has actually entered a value.
Before:
c.value ?? ""— coerces no-input to empty string, always failsAfter:
c.value == null || mapSource.enum?.includes(c.value)— allows unset valuesAny related issues, documentation, discussions?
Fixes #3524
How was this PR tested?
Manually verified the logic change:
undefined == nullevaluates to true, so unset optional fields now pass validationWas this PR authored or co-authored using generative AI tooling?
Co-authored using Claude (Anthropic). The fix was reviewed and verified by the author.