I’m trying out Springs declarative REST client (with org.springframework.web.client.RestClient).
I have a wrapper:
@JvmInline
value class CustomId(val id: String)
And now I want to use that wrapper in my interface:
interface FooClient {
@GetExchange(value = "/service/{id}")
fun hamtaTaxeringsenhet(@PathVariable id: CustomId): Bar
}
The problem with this is that Spring converts CustomId with its toString() function and sends that to the downstream server.
If I use String instead of my custom type it works:
```kotlin
interface FooClient {
@GetExchange(value = "/service/{id}")
fun hamtaTaxeringsenhet(@PathVariable id: String): Bar
}
But I want to have type safety so I don’t want to use String.
I don’t want to override CustomId’s toString() function either.
Any ideas how I to make Spring convert CustomId to a String (CustomId.id) automatically?
Regards, Peter