Deserialization fails without DOUBLE_QUOTATION
YokiToki opened this issue · comments
Stanislav Karakovskii commented
Hi, I'm trying serialize and deserialize given string and get error without double quotation setting. Perhaps it would be correct if force add double quotes to strings when need for correct deserialize. Otherwise, the library creates a string with which it cannot work itself. What do you think?
class MainTests {
private val yaml = Yaml {
// Error without DOUBLE_QUOTATION
//stringSerialization = DOUBLE_QUOTATION
}
@Serializable
data class TestData(
val test: String,
val test2: String,
val test3: String,
)
@Test
fun testYaml() {
val data = TestData(
test = "testString",
test2 = "--some \"text {{.val}}\\t{{.another}}\"",
test3 = "\${testString}",
)
val encodedString = yaml.encodeToString(TestData.serializer(), data)
println(encodedString)
val decodedData = yaml.decodeFromString(TestData.serializer(), encodedString)
println(decodedData)
assertEquals(data, decodedData)
}
}
Him188 commented
Thank you for your report. After investigation, I confirm that it's a bug. I will publish 0.7.5 to fix it.