KEMBAR78
Query param route predicate - extension of QueryRoutePredicateFactory by polifr · Pull Request #3472 · spring-cloud/spring-cloud-gateway · GitHub
Skip to content

Conversation

@polifr
Copy link
Contributor

@polifr polifr commented Jul 23, 2024

I tried to generalize the QueryRoutePredicateFactory so that it could use a bean of type Predicate instead of being limited to a regexp. Test classes are also implemented.

@spencergibb
Copy link
Member

I'd prefer this in one class as having multiple query predicates is confusing.

@polifr
Copy link
Contributor Author

polifr commented Sep 26, 2024

@spencergibb you are suggesting to merge the two classes into one single predicate factory, that can manage both cases, right? I can do it, paying attention not to introduce regressions on the QueryRoutePredicateFactory.

@spencergibb
Copy link
Member

@polifr yes, since this will only be available thru the java dsl, it should be ok. the regex can be retrofit to a Predicate.

@polifr
Copy link
Contributor Author

polifr commented Oct 3, 2024

@spencergibb I modified the QueryRoutePredicateFactory class to unify the regexp and predicate approach. Let me know if this is what you meant, so that I can proceed with adjustments on junit tests and cleaning of the previous proposal.

Copy link
Member

@spencergibb spencergibb left a comment

Choose a reason for hiding this comment

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

Yes, you can now remove QueryParamRoutePredicateFactory

@spencergibb
Copy link
Member

Yes, you can now remove QueryParamRoutePredicateFactory

@polifr
Copy link
Contributor Author

polifr commented Oct 15, 2024

Ok, I removed the QueryParamRoutePredicateFactory and QueryParamRoutePredicateFactoryTests and extend the current QueryRoutePredicateFactoryTests to cover the new options. I also fixed the checkstyle errors that made the build fail.

@polifr polifr requested a review from spencergibb November 5, 2024 08:10
@polifr
Copy link
Contributor Author

polifr commented Dec 23, 2024

Hi @spencergibb , is there something that stills blocks this pull request? I can't see any change request that has to be done.

@polifr
Copy link
Contributor Author

polifr commented Dec 23, 2024

There was a format error in the header of the test class, I fixed it.

@spencergibb
Copy link
Member

@polifr can you add a commit signature for the DCO and then I will merge

polifr added 11 commits February 1, 2025 03:03
A predicate that checks if a query parameter value matches criteria of a
given predicate.

Signed-off-by: Francesco Poli <polifr@gmail.com>
Signed-off-by: Francesco Poli <polifr@gmail.com>
Signed-off-by: Francesco Poli <polifr@gmail.com>
Signed-off-by: Francesco Poli <polifr@gmail.com>
Signed-off-by: Francesco Poli <polifr@gmail.com>
Signed-off-by: Francesco Poli <polifr@gmail.com>
Signed-off-by: Francesco Poli <polifr@gmail.com>
Signed-off-by: Francesco Poli <polifr@gmail.com>
Signed-off-by: Francesco Poli <polifr@gmail.com>
Signed-off-by: Francesco Poli <polifr@gmail.com>
Fix copyright header comment

Signed-off-by: Francesco Poli <polifr@gmail.com>
@polifr polifr force-pushed the param-route-predicate branch from ace7e48 to 31902af Compare February 1, 2025 02:05
…redicate

# Conflicts:
#	spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/route/builder/PredicateSpec.java
#	spring-cloud-gateway-server/src/test/java/org/springframework/cloud/gateway/handler/predicate/QueryRoutePredicateFactoryTests.java

Signed-off-by: Francesco Poli <polifr@gmail.com>
@spencergibb
Copy link
Member

Perfect, thanks

@spencergibb spencergibb removed this from 2025.0.0-M2 Mar 3, 2025
@spencergibb spencergibb moved this to In Progress in 2025.0.0-M3 Mar 3, 2025
@spencergibb spencergibb added this to the 4.3.0-M3 milestone Mar 3, 2025
@spencergibb spencergibb merged commit ed9a24a into spring-cloud:main Mar 3, 2025
2 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in 2025.0.0-M3 Mar 3, 2025
@polifr
Copy link
Contributor Author

polifr commented Mar 4, 2025

Thank you, @spencergibb
Just two questions... First, about documentation update: this change has to be shown also in the request-predicates-factories.html page? If so, which is the process for update the page?
Next, do you think a similar approach is useful to be applied also on other RoutePredicateFactory implementation? In this case, I can open a new merge request and replicate it; let me know your opinion about this.

Been24 pushed a commit to Been24/spring-cloud-gateway that referenced this pull request Mar 14, 2025
…spring-cloud#3472)

* Creation of QueryParamRoutePredicateFactory

A predicate that checks if a query parameter value matches criteria of a
given predicate.

Signed-off-by: Francesco Poli <polifr@gmail.com>

* Fix predicate method

Signed-off-by: Francesco Poli <polifr@gmail.com>

* Factory fixes and junit test coverage

Signed-off-by: Francesco Poli <polifr@gmail.com>

* Fix on predicate check for tests

Signed-off-by: Francesco Poli <polifr@gmail.com>

* Regexp management via predicate and configuration extension

Signed-off-by: Francesco Poli <polifr@gmail.com>

* Validation enforcing - tryout

Signed-off-by: Francesco Poli <polifr@gmail.com>

* Checkstyle formatting fix

Signed-off-by: Francesco Poli <polifr@gmail.com>

* Deletion of QueryParamRoutePredicateFactory class and test

Signed-off-by: Francesco Poli <polifr@gmail.com>

* Update in QueryRoutePredicateFactory creation with Predicate

Signed-off-by: Francesco Poli <polifr@gmail.com>

* Unit test update

Signed-off-by: Francesco Poli <polifr@gmail.com>

* Update QueryRoutePredicateFactoryPredicateTests.java

Fix copyright header comment

Signed-off-by: Francesco Poli <polifr@gmail.com>

---------

Signed-off-by: Francesco Poli <polifr@gmail.com>
Signed-off-by: ubest <zhangfeng@sipg.com.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants