spring-cloud-openfeign
spring-cloud-openfeign copied to clipboard
Feign doesn't support regexp in request mapping
If I use interface
public interface UserAPI {
@RequestMapping(method = GET, path = "/user/{username:[a-z@A-Z\\d\\.-_]+}"
UserDTO getUserByUsername();
}
And want to create client as
@FeignClient("service")
public interface UserClient extends UserAPI{}
it won't work because feign thinks that pattern is part of path. It's even more impressive if you want to use pattern like .+
Any timeframe on this being included in an upcoming release?
@jmgilmour no. PRs welcome.
Thanks for the quick response. I was under the impression that the referenced commit by @venilnoronha above would fix this issue.
That commit merely didn't error if there was a regex, it didn't support them.
Good to know :smile:. I guess I'll take a crack at a fix and PR when I get the chance. Again, thanks for the quick response.
Support for this was added in feign-core
10.x as part of the uri expression updates. It's now possible to define an expression with a pattern and the pattern will be enforced during expansion. Might be straightforward to take advantage here.