You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is your use-case and why do you need this feature?
I am using JsonContentPolymorphicSerializer to deserialize JSON similar to the following:
Either:
{
"$ref": "<some URI>"
}
or
{
"actual": "data"
}
I'd like to improve the default descriptor provided by JsonContentPolymorphicSerializer, similar to the one provided by SealedClassSerializer. However it is currently impossible to construct a SerialDescriptor other than StructureKind.CLASS or primitive without using the internal API buildSerialDescriptor, which states:
If you end up using this builder, please file an issue with your use-case in kotlinx.serialization
Describe the solution you'd like
A SerialDescriptor builder for PolymorphicKind.SEALED similar to buildSerialDescriptor.
The text was updated successfully, but these errors were encountered:
Currently, SEALED class descriptor has a requirement to contain all possible variants descriptors. I assume you can fulfil this requirement, since you know what serializers you are going to use statically, so it's possible to use internal API to mimic SealedClassSerializer's descriptor.
Why do you need this exact SEALED kind? Are you using something like a schema generator? This kind is not used in a regular serialization for now
Yes, I know all the possible serializers statically.
Why do you need this exact SEALED kind? Are you using something like a schema generator? This kind is not used in a regular serialization for now
Because JsonContentPolymorphicSerializer says you can do so in its docs. However there is no way to do so without using the internal buildSerialDescriptor API.
Either the docs should be changed and descriptor made final or there should be a way to do as the docs say.
What is your use-case and why do you need this feature?
I am using
JsonContentPolymorphicSerializer
to deserialize JSON similar to the following:Either:
or
I'd like to improve the default
descriptor
provided byJsonContentPolymorphicSerializer
, similar to the one provided bySealedClassSerializer
. However it is currently impossible to construct aSerialDescriptor
other thanStructureKind.CLASS
or primitive without using the internal APIbuildSerialDescriptor
, which states:Describe the solution you'd like
A
SerialDescriptor
builder forPolymorphicKind.SEALED
similar tobuildSerialDescriptor
.The text was updated successfully, but these errors were encountered: