spring-cloud-gateway icon indicating copy to clipboard operation
spring-cloud-gateway copied to clipboard

Query param route predicate - extension of QueryRoutePredicateFactory

Open polifr opened this issue 1 year ago • 6 comments

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

polifr avatar Jul 23 '24 23:07 polifr

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

spencergibb avatar Sep 25 '24 16:09 spencergibb

@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.

polifr avatar Sep 26 '24 06:09 polifr

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

spencergibb avatar Sep 27 '24 16:09 spencergibb

@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.

polifr avatar Oct 03 '24 11:10 polifr

Yes, you can now remove QueryParamRoutePredicateFactory

spencergibb avatar Oct 15 '24 18:10 spencergibb

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 avatar Oct 15 '24 22:10 polifr

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

polifr avatar Dec 23 '24 13:12 polifr

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

polifr avatar Dec 23 '24 15:12 polifr

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

spencergibb avatar Jan 31 '25 16:01 spencergibb

Perfect, thanks

spencergibb avatar Feb 01 '25 02:02 spencergibb

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.

polifr avatar Mar 04 '25 12:03 polifr