-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[BUG] Query with nested property that contains spaces causes invalid parameter name #23084
Labels
azure-spring
All azure-spring related issues
azure-spring-cosmos
Spring cosmos related issues.
bug
This issue requires a change to an existing behavior in the product in order to be resolved.
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
Comments
ghost
added
needs-triage
Workflow: This is a new issue that needs to be triaged to the appropriate team.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
labels
Jul 20, 2021
joshfree
added
azure-spring
All azure-spring related issues
azure-spring-cosmos
Spring cosmos related issues.
bug
This issue requires a change to an existing behavior in the product in order to be resolved.
Client
This issue points to a problem in the data-plane of the library.
and removed
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
labels
Jul 20, 2021
ghost
removed
the
needs-triage
Workflow: This is a new issue that needs to be triaged to the appropriate team.
label
Jul 20, 2021
@backwind1233 could you please follow up with @gogopavl? |
I will be working with @gogopavl on this issue, assigning myself to it. |
gogopavl
pushed a commit
to gogopavl/azure-sdk-for-java
that referenced
this issue
Aug 4, 2021
Replace any non-alphanumeric characters in the generated query parameter name with an underscore so that criteria with references to nested properties such as user['first name'] do not result in a bad request due to invalid query parameter name. Resolves Azure#23084
gogopavl
added a commit
to gogopavl/azure-sdk-for-java
that referenced
this issue
Aug 4, 2021
Replace any non-alphanumeric characters in the generated query parameter name with an underscore so that criteria with references to nested properties such as user['first name'] do not result in a bad request due to invalid query parameter name. Resolves Azure#23084
gogopavl
added a commit
to gogopavl/azure-sdk-for-java
that referenced
this issue
Aug 4, 2021
Replace any non-alphanumeric characters in the generated query parameter name with an underscore so that criteria with references to nested properties such as user['first name'] do not result in a bad request due to invalid query parameter name. Resolves Azure#23084
@kushagraThapar issued a PR that should resolve this bug - #23341 |
@gogopavl - thank you for your contribution, I will review it soon. |
gogopavl
added a commit
to gogopavl/azure-sdk-for-java
that referenced
this issue
Aug 13, 2021
Assert the change in the behaviour of the query parameter name generator by adding more tests using the reactive cosmos template References Azure#23084
gogopavl
added a commit
to gogopavl/azure-sdk-for-java
that referenced
this issue
Aug 20, 2021
Assert the change in the behaviour of the query parameter name generator by adding more tests using the reactive cosmos template References Azure#23084
kushagraThapar
pushed a commit
that referenced
this issue
Aug 23, 2021
* fix query parameter name generator in azure-spring-data-cosmos Replace any non-alphanumeric characters in the generated query parameter name with an underscore so that criteria with references to nested properties such as user['first name'] do not result in a bad request due to invalid query parameter name. Resolves #23084 * add test cases for parameter name generator using async API Assert the change in the behaviour of the query parameter name generator by adding more tests using the reactive cosmos template References #23084
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
azure-spring
All azure-spring related issues
azure-spring-cosmos
Spring cosmos related issues.
bug
This issue requires a change to an existing behavior in the product in order to be resolved.
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
Describe the bug
Issuing a query using custom
Criteria
through aCosmosTemplate
in cases where the underlying document has a nested key with spaces results in an error because of the way the query parameter name is generated.The library, as is, supports the execution of queries with nested properties, but only with the use of the dot notation (e.g.
c.someCollection.someKey.value
). When the nested property has spaces, though, this will break, which is expected (for instance,c.someCollection.key with spaces.value
).The docs here mention that in such cases the
["..."]
notation should be used (or['']
), which I tried, but results in an error because of how the query parameter name is rendered.Exception or Stack Trace
Getting
java.lang.reflect.UndeclaredThrowableException
when catching the exception , but after a bit of digging found that the underlying error is the following:Which is part of
To Reproduce
Code Snippet
section right below.azure-spring-data-cosmos-3.8.0
library, useCriteria
to formulate and issue a query with an equalityCriteriaType
via aCosmosTemplate
.subject
of the enforcedCriteria
contains square brackets to specify nested keys with spaces (["..."]
or['...']
) then the query results in an error due to the illegal generated parameter name (library code).Code Snippet
Expected behavior
When querying the container for documents that match the specified
Criteria
for the nested properties that may contain spaces I would expect that the query isn't flagged because of the generated parameter name. As this is based on the SQL API, my expectation is that this should work using the Java SDK just as it does from data explorer.Screenshots
N/A
Setup (please complete the following information):
Additional context
I came across an older bug (has been resolved) that is similar here: issue 221
Information Checklist
The text was updated successfully, but these errors were encountered: