fix: fixes vector stage input parsing for aggregate tool MCP-336 #794
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.
Proposed changes
Users were unable to use VectorSearch stage because Zod was using our catch all stage (AnyAggregateStage) before VectorSearchStage to parse and validate even the vector search stage input and it passed through because that schema is a catch all schema.
Because of that, in the input that we received, outputDimension was not transformed ever.
This commit changes the order of application of schema so that VectorSearchStage schema is validated first and then the catch all stage schema.
Checklist