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
I just noticed that if you have a nullable list like
@Serializable
data class TestClass(
val n: List<String>? = null
)
and you try to read it with
val yaml =
"""
n: ~
""".trimIndent()
val obj = Yaml.default.decodeFromString<TestClass>(yaml)
It fails with the exception:
Value for 'n' is invalid: Expected a list, but got a scalar value
com.charleskorn.kaml.InvalidPropertyValueException at n on line 2, column 4: Value for 'n' is invalid: Expected a list, but got a scalar value
The text was updated successfully, but these errors were encountered:
Looking further at the spec, I figured out that ~ is only supported in the Core spec, not the JSON spec.
Which spec is this library targeting? https://yaml.org/spec/1.2/spec.html#Schema
Thanks for the report @BloodWorkXGaming, you're correct - ~ should be treated as a null value. In the JSON schema, null is the canonical form (so null should be emitted by default), but this should not impact parsing.
I just noticed that if you have a nullable list like
and you try to read it with
It fails with the exception:
The text was updated successfully, but these errors were encountered: