Him188 / yamlkt

Multiplatform YAML parser & serializer for kotlinx.serialization written in pure Kotlin
Apache License 2.0
132 stars 14 forks source link

Negative number in a list is not handled #70

Open tapankavasthi opened 7 months ago

tapankavasthi commented 7 months ago

Steps to reproduce

Sample Yaml:

- 123
- 456
- -23

Sample code:

val parsedData: List<Any?> = Yaml.Default.decodeListFromString(yamlStr)

Discrepancy:

Expected [123, 456, -23]
Actual [123, 456, [23]]

For the last entry, the parser treats it as a start of another list, instead of considering it as a negative number.

As per the specs, there must be a space after the dash for a list component.