feign icon indicating copy to clipboard operation
feign copied to clipboard

Why not support multiple @QueryMap at the same time

Open Hccake opened this issue 2 years ago • 4 comments

I have an API that looks something like this :

    @GetMapping("demo")
    public String demo(PageParam pageParam, Query query){
        return "success";
    }

I wish I could call this in feign Client:

public interface DemoFeignClient {
    @GetMapping("demo")
    String demo(@QueryMap PageParam pageParam,  @QueryMap Query query);
}

But feign only passes the attributes of the first object.

Why not support simultaneous use @QueryMap ?

Hccake avatar Sep 16 '21 11:09 Hccake

queryMapIndex paramter is only one

mroccyen avatar Jun 02 '22 06:06 mroccyen

queryMapIndex paramter is only one

Sorry, what I asked was why it was designed this way. At present, I have achieved multiple @QueryMap support by overriding Feign.class.

Hccake avatar Jun 02 '22 06:06 Hccake

I think it will confuse encoders if multiple @QueryMap annotations are allowed:

public interface TestFeignClient {
    @GetMapping("test")
    String test(@QueryMap A a, @QueryMap B b, @QueryMap C c);
}
class A {
    String name;
}
class B {
    String name; // duplicate
}
class C <T> {
    T name; // may be not string
}

Not sure which name should be used

yihleego avatar Sep 07 '22 08:09 yihleego

I think it will confuse encoders if multiple @QueryMap annotations are allowed:

public interface TestFeignClient {
    @GetMapping("test")
    String test(@QueryMap A a, @QueryMap B b, @QueryMap C c);
}
class A {
    String name;
}
class B {
    String name; // duplicate
}
class C <T> {
    T name; // may be not string
}

Not sure which name should be used

I think encoding this kind of scenario directly should pose no issues, and the resulting QueryString would also be normal.

uliian avatar Nov 01 '23 07:11 uliian