-
Notifications
You must be signed in to change notification settings - Fork 623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Experimental UuidSerializer breaks projects with custom UUID serializer #2799
Comments
I forgot to mention, our current UUID serializer is for the java.util.UUID class. So it's not the same type that the serializer is made for. In the linked repository we have a typealias for that so it may not be obvious from reading the code. |
It wasn't our intention to break users' serializers, especially those that work with I still want to point out that providing a library with a serializer that is named just |
in PrimitiveSerialDescriptor constructor. By doing so, we allow users to declare their own serializers with short names like "Uuid" or "Duration", even though it is not recommended — because they may have been declared before library updates. Fixes #2799
Thanks for picking it up! Regarding the names, I wasn't that familiar with the serialization library when I first wrote that uuid serializer. The documentation example also uses a simple name (just "Color") so I never thought much about it. I'll update our serializers so they're prefixes to avoid any future problems. Thanks for the tip! |
@sandwwraith could you please fix the example from the guide as well? |
Just ran into this too, downgraded back to 1.7.1 |
Wait so I can write a serialize with the same name as another one to override a library one? And it's case insensitive? That seems like a little bit of an oversight? They should at least be package name sensitive? |
Oh for reference my issue is similar but different, I just get |
@sandwwraith we have run into the same issue, and our serializer class has a custom name. Serializer class name that conflict are:
Both of them cause conflict with the built-in serializer in 1.7.2
We are also deserializing the |
Ah ok, I see: we have to change the name in the |
Yes, the name is used by formats for caching (and resolving polymorphic children), and thus needs to be unique. |
I feel dumb as the error is pretty clear, but it only just clicked it's the string name of the descriptor not the |
…r creation because serial names should be unique across all dependencies. Fixes #2247 and #2799 (comment)
…r creation because serial names should be unique across all dependencies. Fixes #2247 and #2799 (comment)
Describe the bug
A project using a custom UUID serializer with the name of the serial descriptor set to
UUID
(casing does not matter) will break with the recent 1.7.2 release. Even though the new serializer is not used, the serialization library will throw the following error:While I would argue this is fine to happen in a 1.8 release, it's not in a patch release. In this specific case, the serializer is added in an SDK that is used by multiple apps. If one of those apps were to update to kotlinx.serialization 1.7.3 they would also be affected by this issue.
To Reproduce
Expected behavior
In any 1.7.z release a custom serializer should just work.
Environment
The text was updated successfully, but these errors were encountered: