From 77af2c971b2ec30140bed3c99c26b8704586dc34 Mon Sep 17 00:00:00 2001 From: Leonid Startsev Date: Tue, 22 Aug 2023 13:59:49 +0200 Subject: [PATCH] Fix incorrect descriptor in advanced JsonDecoder/Encoder example (#2415) --- docs/json.md | 6 +++--- guide/example/example-json-26.kt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/json.md b/docs/json.md index 07476f971b..d764ce5f7f 100644 --- a/docs/json.md +++ b/docs/json.md @@ -1128,10 +1128,10 @@ sealed class Response { class ResponseSerializer(private val dataSerializer: KSerializer) : KSerializer> { override val descriptor: SerialDescriptor = buildSerialDescriptor("Response", PolymorphicKind.SEALED) { - element("Ok", buildClassSerialDescriptor("Ok") { - element("message") + element("Ok", dataSerializer.descriptor) + element("Error", buildClassSerialDescriptor("Error") { + element("message") }) - element("Error", dataSerializer.descriptor) } override fun deserialize(decoder: Decoder): Response { diff --git a/guide/example/example-json-26.kt b/guide/example/example-json-26.kt index 32b2fb6558..c308b6346e 100644 --- a/guide/example/example-json-26.kt +++ b/guide/example/example-json-26.kt @@ -15,10 +15,10 @@ sealed class Response { class ResponseSerializer(private val dataSerializer: KSerializer) : KSerializer> { override val descriptor: SerialDescriptor = buildSerialDescriptor("Response", PolymorphicKind.SEALED) { - element("Ok", buildClassSerialDescriptor("Ok") { - element("message") + element("Ok", dataSerializer.descriptor) + element("Error", buildClassSerialDescriptor("Error") { + element("message") }) - element("Error", dataSerializer.descriptor) } override fun deserialize(decoder: Decoder): Response {