Extend custom serializers support in decoding#318
Conversation
bdeccad to
1e7d6c8
Compare
1e7d6c8 to
0670267
Compare
| * @param config - decoding configuration for parsing and serialization | ||
| * @return decoded (deserialized) object of type T | ||
| */ | ||
| public fun <T> decode( |
There was a problem hiding this comment.
hm, don't get the idea - why this should be added to particular desrializers like ArrayDecoder?
There was a problem hiding this comment.
I did the same as I did for map: #291 (comment)
Now in Toml.kt we have:
private fun <T> decode(deserializer: DeserializationStrategy<T>, parsedToml: TomlFile): T =
when (deserializer.descriptor.kind) {
StructureKind.LIST -> TomlArrayDecoder.decode(deserializer, parsedToml.getFirstChild() as TomlKeyValueArray, inputConfig)
StructureKind.MAP -> TomlMapDecoder.decode(deserializer, parsedToml, inputConfig)
else -> TomlMainDecoder.decode(deserializer, parsedToml, inputConfig)
}It's used only with delegating serializer (see delegatingSerializer test)
| import kotlin.test.Test | ||
| import kotlin.test.assertEquals | ||
|
|
||
| class CustomSerializerTest { |
There was a problem hiding this comment.
I remember, I had CustomSerializerTest with some @ignored tests
kotlin/com/akuleshov7/ktoml/decoders/CustomSerializerTest.kt
May be unify and remove @Ignored in some of tests? 🙏🏾
There was a problem hiding this comment.
It's the same class, I just moved it to /custom/ directory
|
Generally LGTM, also conflicts might be resolved |
|
I believe that once we merge it, it'll be time to make the release. @BOOMeranGG, this release will be yours—and only yours—and it will be officially named 'Evgeny Bykov's Release'! :) I'll also write up a post on Reddit. It’s finally time to push through that 500-star milestone ) |
# Conflicts: # ktoml-core/src/commonTest/kotlin/com/akuleshov7/ktoml/decoders/structures/MapDecoderTest.kt
Haha, thank you! But don't forget other contributors, all my PRs were based on their development :) |
Fix #127
Added tests from https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md#custom-serializers
Contextual (#282) isn't implemented yet