Skip to content
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

fix query parameter name generator in azure-spring-data-cosmos #23341

Conversation

gogopavl
Copy link
Contributor

@gogopavl gogopavl commented 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 #23084

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
@ghost ghost added Cosmos azure-spring All azure-spring related issues customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Aug 4, 2021
@ghost
Copy link

ghost commented Aug 4, 2021

Thank you for your contribution gogopavl! We will review the pull request and get back to you soon.

@ghost
Copy link

ghost commented Aug 4, 2021

CLA assistant check
All CLA requirements met.

@kushagraThapar
Copy link
Member

@mbhaskar - can you please take a look at this PR ?

Copy link
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -567,6 +567,19 @@ public void testBetweenCriteria() {
assertThat(people).containsExactly(TEST_PERSON);
}

@Test
Copy link
Member

Choose a reason for hiding this comment

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

Can you please come up with some more test cases, so that we can avoid regression for this in future ?
For example, you can add few test cases for ReactiveCosmosTemplateIT in addition to CosmosTemplateIT.

We generally prefer to add test cases for both sync and async APIs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kushagraThapar sure, will do!

Initially, I was a bit sceptical to add more because of the overhead incurred by integration tests. I was also considering adding unit tests but saw that there's a preference for integration tests throughout the project.

Copy link
Member

Choose a reason for hiding this comment

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

@gogopavl yes, that would be great.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kushagraThapar
Copy link
Member

@gogopavl - thank you, I will review the code. Meanwhile, I see CI is failing, I think because of some compilation issues. Can you please take a look and fix those ?

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 gogopavl force-pushed the bugfix/23084-invalid-parameter-name-for-nested-property branch from 808d371 to 5399af2 Compare August 20, 2021 12:01
@gogopavl
Copy link
Contributor Author

@gogopavl - thank you, I will review the code. Meanwhile, I see CI is failing, I think because of some compilation issues. Can you please take a look and fix those ?

@kushagraThapar updated. Looks like two pipelines failed but the error doesn't seem specific to my changes.

Noticed that the Cosmos DB Emulator didn't start in those instances: The emulator failed to reach Running status within 600. I tried to re-run these 2 pipelines but can't due to insufficient permissions.

@kushagraThapar
Copy link
Member

@gogopavl - thanks for fixing other issues, I will run the CIs and will let you know in case there are test failures.

@kushagraThapar
Copy link
Member

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kushagraThapar
Copy link
Member

/check-enforcer override

@kushagraThapar kushagraThapar merged commit e813b40 into Azure:main Aug 23, 2021
@kushagraThapar
Copy link
Member

@gogopavl - I have merged this PR, it will get released in our next release. (September 2nd week).
Thanks again for your contribution, we appreciate it!

@gogopavl
Copy link
Contributor Author

@kushagraThapar thank you too for helping out in the process & for your valuable feedback. Looking forward to the release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure-spring All azure-spring related issues Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Query with nested property that contains spaces causes invalid parameter name
3 participants