Tag: 假装

删除feign用于基于收集的参数的方括号

对于以下界面: @RequestLine("GET /v1/users/{userIds}/profile") UserProfiles getUserProfiles( @Param("userIds", expander = UserIdsExpander.class) List<Identifier<User>> userIds ) 扩展器被类型为Identifier<User>的参数调用,而不是List<Identifier> ,这很好,大多数框架也是这样做的(特殊处理集合/地图等),但返回的字符串是: GET /v1/users/[usera,userb,userc]/profile 我所调用的API接受它为GET /v1/users/usera,userb,userc/profile 。 显而易见的解决方法是在接口中只接受CSV作为字符串参数: @RequestLine("…") UserProfiles getUserProfiles(@Param("userIds") String userIds) 但是,然后,用户不得不笨拙地使用(突然kotlin为了简洁): client.getUserProfiles(userIdList.map { IdHelper.toString(it) }.join(",")) 有没有办法删除方括号或使扩展器获得整个集合? 编辑 所以从我所知道的是我可以使用默认的方法,这将接受对象,并调用一个CSV字符串..但仍然保持接受CSV字符串躺在方法,我必须这样做每个方法接受一个自定义的持有对象列表(并且有很多这样的API)。 有没有更好的办法?

Kotlin数据类杰克逊@JsonProperty没有兑现

我使用Kotlin数据类将Feign连接到POST。 我打电话的API期望{…“brandInfo”:{“TPID”:1} …} 我的理解是,如果jackson-module-kotlin的依赖没有被正确拾取,Feign将根本无法开启POST,因为Jackson编码将会彻底失败。 然而,Feign能够发布,杰克逊能够编码,但不管我做什么,发布的是{…“brandInfo”:{“tpid”:1} …},尽管brandInfo val被注释@JsonProperty(“TPID”)。 我错过了什么? @JsonIgnoreProperties(ignoreUnknown = true) data class KBrandInfo ( @JsonProperty("TPID") //not honored val TPID: Long ) interface KConversationServiceClient { @RequestLine("POST v2/conversations") @Headers("Content-Type: application/json") fun createConversation(createConversation: KCreateConversation): String } @Provides public KConversationServiceClient getKConversationServiceClient( @Named("conversationServiceUrl") String baseUri, Feign.Builder builder) { return builder .logLevel(Logger.Level.FULL) .decoder(new StringDecoder()) .encoder(new JacksonEncoder(jacksonObjectMapper())) //does this need some […]