Issue
I've found in FEIGN-README that I can do stuff like:
interface MarketDataRestClient {
@RequestLine("GET /api/v1/depth")
fun getOrderBook(@QueryMap orderBookQuery: OrderBookQuery) : OrderBook
}
OrderBookQuery:
data class OrderBookQuery(val symbol: String, val limit: Int? = 100)
And Feign should generate query params: /api/v1/depth?symbol={symbol}&limit={limit}
Unfortunately all I'm getting is:
Exception in thread "main" java.lang.IllegalStateException: QueryMap parameter must be a Map: class OrderBookQuery
at feign.Util.checkState(Util.java:128)
at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:126)
at feign.Contract$BaseContract.parseAndValidatateMetadata(Contract.java:64)
at feign.ReflectiveFeign$ParseHandlersByName.apply(ReflectiveFeign.java:146)
at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:53)
at feign.Feign$Builder.target(Feign.java:198)
at feign.Feign$Builder.target(Feign.java:194)
Solution
This feature will be available in 9.7
. The current published version, as of the writing of this answer, is 9.6
. If you do not want to wait, please clone the repository and run build the project.
Answered By - Kevin Davis
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.