question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `YAMLGenerator.Feature.INDENT_ARRAYS_WITH_INDICATOR` to indent by 2 spaces

See original GitHub issue

Using a simple piece of code like below - the indentation of the array is only 1 space…

g.writeArrayFieldStart( "schemes" ); g.writeString( url.getProtocol().toLowerCase() ); g.writeEndArray();

Output is as such (bad formatting here - but only 1 space before the dash!): schemes: - http

Using 2.10.2 versions in my pom.xml

<dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-yaml</artifactId> <version>2.10.2</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.10.2</version> </dependency>

YAMLGenerator created as such (tried different combos):

YAMLGenerator g = new YAMLFactoryBuilder( new YAMLFactory() ). configure( Feature.LITERAL_BLOCK_STYLE, true ). configure( Feature.WRITE_DOC_START_MARKER, true ). configure( Feature.INDENT_ARRAYS, true ). build().createGenerator( new PrintWriter( bo ) ); g.disable(Feature.MINIMIZE_QUOTES);

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
cowtowncodercommented, Oct 27, 2020

@IsmailMarmoush I do not ask for CLA because I find it personally useful but because it makes my life as maintainer easier – it is something that has saved me from having to interact much with corporate lawyers. Bigger corporations are wary of OSS projects that do not require contribution attributions; I get contacts about this couple of times per year. So while it may seem tempting to just do something kind of EULA equivalent, I don’t have time or interest to argue that it would be just as good as CLAs, when next paralegal from IBM contacts me. 😃

But fortunately, so far getting CLA has rarely been even temporary blocker.

@dswiecki Thank you!

1reaction
dswieckicommented, Oct 26, 2020

Sory for my delay, I’ll try provide CLA and update PR today

Read more comments on GitHub >

github_iconTop Results From Across the Web

YAMLGenerator.Feature (Jackson-dataformat-YAML 2.12.0 ...
INDENT_ARRAYS_WITH_INDICATOR. Feature enabling of which adds indentation with indicator for array entry generation (default indentation being 2 spaces).
Read more >
Jackson YAML Serialization Object Arrays Format
setIndicatorIndent (2); //This is the workaround. Indent must be set to at least 2 higher than the indicator indent because of how whitespace...
Read more >
168495 – Tab key, insert 2 spaces in yaml
I tried this, and the behavior I observed is the following: 1. By default, when I type Tab in a YAML file, it...
Read more >
YAMLGenerator
Feature enabling of which adds indentation for array entry generation * (default indentation being 2 spaces). *<p> * Default value is {@code false}...
Read more >
VSCode How To Change Indentation - YouTube
Hey guys in this tutorial I'll show you how to choose the number of spaces you want to use to indent your Python...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found