question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stable release & move to Retrofit repo

See original GitHub issue

Hi! As far as I understood from #43 the last thing that prevents this lib from being an official converter in the Retrofit repo is that it depends on the experimental parts of kotlinx.serialization API.

We’ve removed experimentality from StringFormat/BinaryFormat in 1.3.0 release. Am I right that serializer(java.lang.Type) is the only experimental function blocking this?

If so, can you please provide some feedback on it — whether it does the right thing, or some functionality is missing, etc. We’re going to stabilize it soon so converters like this can depend on a stable API.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
JakeWhartoncommented, Nov 1, 2022

Thanks! I’m going to release a stable version of this library for simplicity, and then will migrate it to Retrofit for its next release.

1reaction
sandwwraithcommented, Oct 14, 2022

We’ve been revisiting the design, and while the function is likely to stay, I’d like to ask about the problems with nullability:

Because Java’s type tokens do not contain this information, serializer(Type) always returns non-nullable serializers for all nested types. In practice, this means the following code:

interface MyApi {
  @Get("foo")
  fun getFoo(): List<String?> // or any other nullable type in any position
}

Would fail with deserialization error on the input like ["a", null]. Have you experienced this problem? How severe is it for you?

We currently have several proposals on what to do with it:

  1. Do nothing — if the problem is non-existent in real life
  2. Always wrap all serializers to .nullable inside this function. This would make this function unusable for formats that strictly differentiate nullable vs non-nullable: while Json format can deserialize non-null value with nullable deserializer, Protobuf can’t.
  3. Change signature/provide an additional function with an additional parameter that can alter this behavior. Either serializer(type: Type, wrapIntoNullable: Boolean) or more sophisticated serializer(type: Type, typeArgSerializerFactory: (Type) -> KSerializer<*>) (latter would also probably cover https://github.com/Kotlin/kotlinx.serialization/issues/2025).
Read more comments on GitHub >

github_iconTop Results From Across the Web

square/retrofit: A type-safe HTTP client for Android and the JVM
Retrofit. A type-safe HTTP client for Android and Java. For more information please see the website. Download. Download the latest JAR or grab...
Read more >
Using Retrofit 2.x as REST client - Tutorial - Vogella.com
Retrofit is a REST Client for Java and Android allowing to retrieve and upload JSON (or other structured data) via a REST based...
Read more >
Consuming APIs with Retrofit | CodePath Android Cliffnotes
Retrofit is a type-safe REST client for Android, Java and Kotlin developed by Square ... Assuming you have the JSON response already, go...
Read more >
Retrofit 2.0: The biggest update yet on the best HTTP Client ...
Until last week, Retrofit 2.0 just passed its Release Candidate stage to Beta 1 and has been publicly launched to everyone.
Read more >
No more Retrofit, move to Ktor on Android | by Barros - Medium
Waiting for the stable release of KMM (Kotlin Multiplatform Mobile) it could be useful starting to use this library instead of Retrofit.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found