I have 3 projects: - a pure API project with only models and endpoint interfaces. - a server implementing interfaces with spring rest controllers. - a client implementing interfaces with openfeign.
I can't to add SpringQueryMap annontation (from openfeign) on pure API project because it's implementation independent. I don't like to override every endpoint interface methods with SpringQueryMap annontation.
Could have an boolean option to add this behavior automatically, from spring properties for example.
Comment From: cbezmen
Hi @nickmafra, Could you give more detailed description about your case?
Comment From: nicolasmafra
Take a look at my repository, in the module myrest-api-feign-client: https://github.com/nickmafra/myrest-api
Perhaps it will be clearer.
Comment From: OlgaMaciaszek
@nickmafra Thanks for submitting the issue. That would not really be in keeping with the conventions that have so far been used in OF. We do expect the annotations to be in place. I don't think we would like to change this for this specific annotation.
I don't like to override every endpoint interface methods with SpringQueryMap annotation What do you mean by
override? It should just be enough to add the annotation.
Comment From: spring-cloud-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: nicolasmafra
Code example:
API Interface:
@RequestMapping("/products")
public interface ProductsApiService {
@GetMapping("/{id}")
Product findById(@PathVariable("id") long id);
@GetMapping
GetProductsResponse findAll(@Valid GetProductsRequest request);
}
OpenFeign interface in a different module:
@FeignClient(name = "ProductsApiService", url = "${myrest.api.url}")
public interface ProductsApiClient extends ProductsApiService {
@Override // need to force @SpringQueryMap
@GetMapping
GetProductsResponse findAll(@SpringQueryMap @Valid GetProductsRequest request);
}
I need override all endpoints because of this annotation SpringQueryMap. If there was a spring property to make this feature automatically, it would help a lot.
Comment From: OlgaMaciaszek
You should not reuse the controller classes as Feign Client interfaces. We are not planning to be adding such a feature at this point.
Comment From: nicolasmafra
"You should not reuse the controller classes as Feign Client interfaces." Why not? This help to evict rewrite API definitions: URL paths, HTTP Methods and typed requests and responses.