ktor icon indicating copy to clipboard operation
ktor copied to clipboard

Data conversion with generic

Open qwebot opened this issue 6 years ago • 3 comments

Ktor Version

1.1.2

Hello! I have a problem with DataConversion if it used with generic.

For example my url looks like this /test?ids=1,2,3

I try to do smt like this @Location("/test") class Test(val ids: <List<Long>> = ArrayList()) And try to use custom conversion install(DataConversion) { convert(List<Long>) { decode { values, _ -> // some logic } encode { value -> // some logic } } }

But in runtime there is type erasure, so custom converters contains just java.util.List, but type is java.util.List<java.Lang.Long> so my custom converter never used and DataConversion always try to use DefaultConversionService. So maybe there is some solutions for this case? Thx!

qwebot avatar Jan 30 '19 16:01 qwebot

@cy6erGn0m Do you have any explanation about this?

qwebot avatar Feb 13 '19 20:02 qwebot

Hello! I have the same problem with desirialization String to WrappedObjectId<Any>. It is a part of Kmongo driver.

Any news ?

laserg avatar Feb 14 '19 08:02 laserg

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

oleg-larshin avatar Aug 10 '20 15:08 oleg-larshin