This repository was archived by the owner on Nov 30, 2025. It is now read-only.
Description Describe the bug
Hi! YamlNode loses data and types due to implicit automatic conversion to numbers.
"+44123456" -> 44123456
Reproduction repo
N/A
Steps to reproduce
@Test
fun YamlNode_reproducer () {
// https://yaml.org/spec/1.2.2/#10113-generic-string
val originalYaml = """ |"user":
| "phone_with_prefix_double_quote": "+44123456"
| "phone_with_prefix_single_quote": '+44123456'
| "phone_with_prefix_str_tag": !!str "+44123456"
| "phone_without_prefix": "44123456"
|""" .trimMargin()
val yaml = Yaml (
configuration = YamlConfiguration (
singleLineStringStyle = SingleLineStringStyle .DoubleQuoted ,
ambiguousQuoteStyle = AmbiguousQuoteStyle .DoubleQuoted ,
)
)
val yamlNode = yaml.parseToYamlNode(originalYaml)
val encodedYaml = yaml.encodeToString(yamlNode)
// "phone_with_prefix_double_quote": 44123456
// "phone_with_prefix_single_quote": 44123456
// "phone_with_prefix_str_tag": !!str '44123456'
// "phone_without_prefix": 44123456
expect(encodedYaml).toEqual(originalYaml)
}
Expected behaviour
Quoted strings kept as is, not losing content,
or !!str tag allows you to enforce it.
Actual behaviour
Type is lost (quoted string becomes a number).
String's content is modified
Version information
Any other information
No response
Reactions are currently unavailable
Describe the bug
Hi! YamlNode loses data and types due to implicit automatic conversion to numbers.
"+44123456"->44123456Reproduction repo
N/A
Steps to reproduce
Expected behaviour
Quoted strings kept as is, not losing content,
or
!!strtag allows you to enforce it.Actual behaviour
Version information
Any other information
No response