diff --git a/addons/geary-serialization/src/commonMain/kotlin/com/mineinabyss/geary/serialization/SerializersByMap.kt b/addons/geary-serialization/src/commonMain/kotlin/com/mineinabyss/geary/serialization/SerializersByMap.kt index 71a8dc92..0fd5f8c9 100644 --- a/addons/geary-serialization/src/commonMain/kotlin/com/mineinabyss/geary/serialization/SerializersByMap.kt +++ b/addons/geary-serialization/src/commonMain/kotlin/com/mineinabyss/geary/serialization/SerializersByMap.kt @@ -19,13 +19,14 @@ class SerializersByMap( //TODO allow this to work for all registered classes, not just components override fun getClassFor(serialName: String, namespaces: List): KClass { + val defaultNamespaces = (namespaces + "geary").toSet() val parsedKey = serialName.fromCamelCaseToSnakeCase() return (if (parsedKey.hasNamespace()) serialName2Component[parsedKey] - else namespaces.firstNotNullOfOrNull { namespace -> + else defaultNamespaces.firstNotNullOfOrNull { namespace -> serialName2Component["$namespace:$parsedKey"] }) - ?: error("$parsedKey is not a component registered in any of the namespaces: $namespaces") + ?: error("$parsedKey is not a component registered in any of the namespaces: $defaultNamespaces") } override fun getSerializerFor( diff --git a/addons/geary-serialization/src/jvmMain/kotlin/com/mineinabyss/geary/serialization/formats/YamlFormat.kt b/addons/geary-serialization/src/jvmMain/kotlin/com/mineinabyss/geary/serialization/formats/YamlFormat.kt index 9e4b8dfd..a86c2f89 100644 --- a/addons/geary-serialization/src/jvmMain/kotlin/com/mineinabyss/geary/serialization/formats/YamlFormat.kt +++ b/addons/geary-serialization/src/jvmMain/kotlin/com/mineinabyss/geary/serialization/formats/YamlFormat.kt @@ -1,9 +1,6 @@ package com.mineinabyss.geary.serialization.formats -import com.charleskorn.kaml.Yaml -import com.charleskorn.kaml.YamlConfiguration -import com.charleskorn.kaml.decodeFromStream -import com.charleskorn.kaml.encodeToStream +import com.charleskorn.kaml.* import com.mineinabyss.geary.serialization.formats.Format.ConfigType import kotlinx.serialization.DeserializationStrategy import kotlinx.serialization.SerializationStrategy @@ -22,6 +19,7 @@ class YamlFormat( configuration = YamlConfiguration( encodeDefaults = false, strictMode = false, + polymorphismStyle = PolymorphismStyle.Property ) ) @@ -29,6 +27,7 @@ class YamlFormat( serializersModule = module, configuration = YamlConfiguration( encodeDefaults = false, + polymorphismStyle = PolymorphismStyle.Property ) )