Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAMLGenerator: multiline string will always be quoted when line has trailing space #366

Open
njank opened this issue Dec 22, 2022 · 2 comments
Labels
yaml Issue related to YAML format backend

Comments

@njank
Copy link

njank commented Dec 22, 2022

I am generating a yml file with the below settings:

ObjectMapper mapper = new ObjectMapper(new YAMLFactory()
	.enable(YAMLGenerator.Feature.LITERAL_BLOCK_STYLE)
	.enable(YAMLGenerator.Feature.MINIMIZE_QUOTES)
);

This will write multiline strings as following:

    - replaceInFiles:
        replacement: test
                     123

However if i put a space between "test" and the following line break it will quote the string as if MINIMIZE_QUOTES was disabled:

    - replaceInFiles:
        replacement: "test \n\n123\n"
@cowtowncoder
Copy link
Member

The first thing is that you would also need to include actual code -- what String value are you trying to write?
Description does not give enough details to know what is going on.

Due to complexity of YAML rules for handling white-space, it may be tricky to determine whether behavior makes sense or not tho.
My guess is that quoting would be considered necessary to retain part of whitespace included in String value to write (if any).

@cowtowncoder
Copy link
Member

Also this is wrong repo, moving.

@cowtowncoder cowtowncoder transferred this issue from FasterXML/jackson-dataformat-xml Dec 22, 2022
@cowtowncoder cowtowncoder added the yaml Issue related to YAML format backend label Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
yaml Issue related to YAML format backend
Projects
None yet
Development

No branches or pull requests

2 participants