feat(firestore): Defer pipeline user data validation to execute()#7816
Merged
feat(firestore): Defer pipeline user data validation to execute()#7816
execute()#7816Conversation
MarkDuckworth
approved these changes
Mar 20, 2026
Contributor
MarkDuckworth
left a comment
There was a problem hiding this comment.
LGTM with suggestions
This reverts commit 9edc6af.
GautamSharda
pushed a commit
that referenced
this pull request
Mar 25, 2026
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.
To support standalone stage initializers (such as
subcollection()), that can be constructed without an existing pipeline, we need to decouple stage initialization and user data validation. Standalone functions do not have access toFirestoreordatabaseIdcontext when called, so validation must be deferred until the pipeline is executed withexecute(pipeline).Implementation Details:
select,where,addFields, ...)._validateUserData()traversal toPipelineclass and all stages.execute()to triggerpipeline._validateUserData()before executing the pipeline.Breaking Change:
Errors regarding invalid user data in stages will now be thrown when
execute(pipeline)is called, rather than during the initialization of the stage (pipeline.collection().addFields(/* invalid data */)).This aligns with the behaviour on both iOS, Android, and Java SDKs.
Ported from: firebase/firebase-js-sdk#9715
I also updated the ESLint config rules to allow args to be unused if their identifier starts with an underscore (
_name). Previously the rule was that they can only be underscores (_), which causes issues if there's more than one unused argument. I ran into this issue when implementing the_validateUserData(name: string, ignoreUndefinedProperties: boolean)methods.