Add `YAMLGenerator.Feature.INDENT_ARRAYS_WITH_INDICATOR` to indent by 2 spaces
See original GitHub issueUsing 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:
- Created 4 years ago
- Reactions:1
- Comments:10 (7 by maintainers)
@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!
Sory for my delay, I’ll try provide CLA and update PR today