Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Support for path/query parameters #39

Open
JavierSegoviaCordoba opened this issue Jan 1, 2021 · 6 comments
Open

Support for path/query parameters #39

JavierSegoviaCordoba opened this issue Jan 1, 2021 · 6 comments

Comments

@JavierSegoviaCordoba
Copy link

JavierSegoviaCordoba commented Jan 1, 2021

I am using strongly typed ids (currently with data class until inline class support is available):

@Serializable
data class UserId(val value: Long)

@Serializable
data class User(val id: UserId, val name: String)

interface UsersService {

    @GET("users")
    suspend fun getUsers(): List<User> // this works

    @GET("users/{id}")
    suspend fun getUser(@Path("id") id: UserId): User // this doesn't work, because the path is `.../users/UserId(value=1)`
}
@JavierSegoviaCordoba
Copy link
Author

As a workaround, I added toString method to UserId

@xanscale
Copy link

this does not affect this library and it is not a bug either, but it is a misuse

@sschuberth
Copy link

this does not affect this library and it is not a bug either, but it is a misuse

@xanscale, can you elaborate why this is a misuse?

My guess is something into the direction of "the interpolation of the placeholders in the @get strings should not rely on details of the underlying serializer".

@xanscale
Copy link

xanscale commented May 2, 2022

@sschuberth first this things impact retrofit and not this converter

second, retrofit call toString() to create the final string, adding "toString" is not a woraround but the correct way

@xanscale
Copy link

xanscale commented May 2, 2022

@JakeWharton you can close this UNissue

@JavierSegoviaCordoba
Copy link
Author

The issue is with inline classes and value classes, based on they are a wrapper over a type, having to manually write toString for them is just boilerplate IMO.

Basically is simplifying this article from Jake on Retrofit

https://jakewharton.com/inline-classes-make-great-database-ids/

Not sure how they are working at this moment in Sqldelight tho.

sschuberth added a commit to oss-review-toolkit/ort that referenced this issue May 2, 2022
Note that Retrofit calls `toString()` to convert enums used as part of
@get paths to strings. In particular, Retrofit does not use the underlying
serializer's string representation. Also see [1].

[1]: JakeWharton/retrofit2-kotlinx-serialization-converter#39

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch.io>
sschuberth added a commit to oss-review-toolkit/ort that referenced this issue May 3, 2022
Note that Retrofit calls `toString()` to convert enums used as part of
@get paths to strings. In particular, Retrofit does not use the underlying
serializer's string representation. Also see [1].

[1]: JakeWharton/retrofit2-kotlinx-serialization-converter#39

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch.io>
sschuberth added a commit to oss-review-toolkit/ort that referenced this issue May 16, 2022
Note that Retrofit calls `toString()` to convert enums used as part of
@get paths to strings. In particular, Retrofit does not use the underlying
serializer's string representation. Also see [1].

[1]: JakeWharton/retrofit2-kotlinx-serialization-converter#39

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch.io>
sschuberth added a commit to oss-review-toolkit/ort that referenced this issue May 16, 2022
Note that Retrofit calls `toString()` to convert enums used as part of
@get paths to strings. In particular, Retrofit does not use the underlying
serializer's string representation. Also see [1].

[1]: JakeWharton/retrofit2-kotlinx-serialization-converter#39

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch.io>
sschuberth added a commit to oss-review-toolkit/ort that referenced this issue May 17, 2022
Note that Retrofit calls `toString()` to convert enums used as part of
@get paths to strings. In particular, Retrofit does not use the underlying
serializer's string representation. Also see [1].

[1]: JakeWharton/retrofit2-kotlinx-serialization-converter#39

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch.io>
sschuberth added a commit to oss-review-toolkit/ort that referenced this issue May 17, 2022
Note that Retrofit calls `toString()` to convert enums used as part of
@get paths to strings. In particular, Retrofit does not use the underlying
serializer's string representation. Also see [1].

[1]: JakeWharton/retrofit2-kotlinx-serialization-converter#39

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch.io>
sschuberth added a commit to oss-review-toolkit/ort that referenced this issue May 17, 2022
Note that Retrofit calls `toString()` to convert enums used as part of
@get paths to strings. In particular, Retrofit does not use the underlying
serializer's string representation. Also see [1].

[1]: JakeWharton/retrofit2-kotlinx-serialization-converter#39

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch.io>
sschuberth added a commit to oss-review-toolkit/ort that referenced this issue May 17, 2022
Note that Retrofit calls `toString()` to convert enums used as part of
@get paths to strings. In particular, Retrofit does not use the underlying
serializer's string representation. Also see [1].

[1]: JakeWharton/retrofit2-kotlinx-serialization-converter#39

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch.io>
sschuberth added a commit to oss-review-toolkit/ort that referenced this issue May 17, 2022
Note that Retrofit calls `toString()` to convert enums used as part of
@get paths to strings. In particular, Retrofit does not use the underlying
serializer's string representation. Also see [1].

[1]: JakeWharton/retrofit2-kotlinx-serialization-converter#39

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch.io>
sschuberth added a commit to oss-review-toolkit/ort that referenced this issue May 23, 2022
Note that Retrofit calls `toString()` to convert enums used as part of
@get paths to strings. In particular, Retrofit does not use the underlying
serializer's string representation. Also see [1].

[1]: JakeWharton/retrofit2-kotlinx-serialization-converter#39

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch.io>
porsche-rbieniek pushed a commit to porsche-rbieniek/ort that referenced this issue Jun 24, 2022
Note that Retrofit calls `toString()` to convert enums used as part of
@get paths to strings. In particular, Retrofit does not use the underlying
serializer's string representation. Also see [1].

[1]: JakeWharton/retrofit2-kotlinx-serialization-converter#39

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch.io>
porsche-rbieniek pushed a commit to porsche-rbieniek/ort that referenced this issue Jun 27, 2022
Note that Retrofit calls `toString()` to convert enums used as part of
@get paths to strings. In particular, Retrofit does not use the underlying
serializer's string representation. Also see [1].

[1]: JakeWharton/retrofit2-kotlinx-serialization-converter#39

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch.io>
porsche-rbieniek pushed a commit to porsche-rbieniek/ort that referenced this issue Jun 27, 2022
Note that Retrofit calls `toString()` to convert enums used as part of
@get paths to strings. In particular, Retrofit does not use the underlying
serializer's string representation. Also see [1].

[1]: JakeWharton/retrofit2-kotlinx-serialization-converter#39

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch.io>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants