Skip to content

Validate String based aggregation on query method creation. #4547

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

Closed
wants to merge 3 commits into from

Conversation

christophstrobl
Copy link
Member

Related to: #4546

This commit makes sure to fail early if an annotated string based annotation does not contain a syntactically valid pipeline.
@@ -504,6 +504,16 @@ public void verify() {
}
}
}
if (hasAnnotatedAggregation()) {
for (String stage : getAnnotatedAggregation()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using ParameterBindingJsonReader to verify that each declaration contains a single object?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The QueryMethod itself does at this point not know about any parameters nor the parser to use so any validation attempt would be quite error prone due to the potential, non resolvable placeholders contained in the source string.
However there's BsonUtils#isJsonArray which we might want to reuse.

mp911de pushed a commit that referenced this pull request Nov 6, 2023
This commit makes sure to fail early if an annotated string based annotation does not contain a syntactically valid pipeline.

Original pull request: #4547
Closes #4546
mp911de added a commit that referenced this pull request Nov 6, 2023
Consistent offending method name format.

Use String.format(…) instead of formatted(…).

Original pull request: #4547
See #4546
@mp911de mp911de linked an issue Nov 6, 2023 that may be closed by this pull request
@mp911de mp911de added this to the 4.1.6 (2023.0.6) milestone Nov 6, 2023
mp911de pushed a commit that referenced this pull request Nov 6, 2023
This commit makes sure to fail early if an annotated string based annotation does not contain a syntactically valid pipeline.

Original pull request: #4547
Closes #4546
mp911de added a commit that referenced this pull request Nov 6, 2023
Consistent offending method name format.

Use String.format(…) instead of formatted(…).

Original pull request: #4547
See #4546
@mp911de mp911de closed this Nov 6, 2023
@mp911de mp911de deleted the issue/4546 branch November 6, 2023 14:01
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.

NoSuchElementException throws while using @Aggregation to group
2 participants