We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It seems that retrofit requires the @QueryMap types to be explictly stated
@QueryMap
ServiceService service = rancher.type(io.rancher.service.ServiceService.class); Filters f = new Filters(); f.put("name", "testname"); Response<TypeCollection<Service>> response = service.list(f).execute();
produces
java.lang.IllegalArgumentException: Map must include generic types (e.g., Map<String, String>) (parameter #1) for method ServiceService.list
This simple patch fixed it:
diff --git a/src/main/java/io/rancher/base/Filters.java b/src/main/java/io/rancher/base/Filters.java index da9e8b9..23b1130 100644 --- a/src/main/java/io/rancher/base/Filters.java +++ b/src/main/java/io/rancher/base/Filters.java @@ -2,5 +2,5 @@ package io.rancher.base; import java.util.HashMap; -public class Filters extends HashMap<String, String> { +public class Filters<K,V> extends HashMap<K, V> { }
Followed by a ack Filters -l | xargs sed -ri 's/Filters filters/Filters<String, String> filters/'
ack Filters -l | xargs sed -ri 's/Filters filters/Filters<String, String> filters/'
The text was updated successfully, but these errors were encountered:
Ah, this can easily be changed in the service template
diff --git a/generator/service.template b/generator/service.template index 0b30ba6..7c5bef6 100644 --- a/generator/service.template +++ b/generator/service.template @@ -21,7 +21,7 @@ public interface {{.class}}Service { Call<TypeCollection<{{.class}}>> list(); @GET("{{.type}}") - Call<TypeCollection<{{.class}}>> list(@QueryMap Filters filters); + Call<TypeCollection<{{.class}}>> list(@QueryMap Filters<String, String> filters); @GET("{{.type}}/{id}") Call<{{.class}}> get(@Path("id") String id);
Sorry, something went wrong.
No branches or pull requests
It seems that retrofit requires the
@QueryMap
types to be explictly statedproduces
This simple patch fixed it:
Followed by a
ack Filters -l | xargs sed -ri 's/Filters filters/Filters<String, String> filters/'
The text was updated successfully, but these errors were encountered: