Skip to content

Positive numbers with plus sign not quoted correctly with ALWAYS_QUOTE_NUMBERS_AS_STRINGS #373

@dyadyaJora

Description

@dyadyaJora

Hello!
I found a case which is very similar to #182 but for positive numbers with plus sign.
Serializing 14 currently results in "14".
Serializing -14 currently results in "-14".
But Serializing +14 currently results in +14, instead of "+14".

It looks like update PLAIN_NUMBER_P regexp with (-|\\+)?[0-9]*(\\.[0-9]*)? in https://github.com/FasterXML/jackson-dataformats-text/blob/2.15/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java#L220 should solve this problem.
https://regex101.com/r/eQo6ag/1

Do you have any objections about this fix?
I am ready to open PR =)

Metadata

Metadata

Assignees

No one assigned

    Labels

    yamlIssue related to YAML format backend

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions