Skip to content

Add YAMLGenerator.Feature.INDENT_ARRAYS_WITH_INDICATOR to indent by 2 spaces #175

@jn-asseco

Description

@jn-asseco

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);

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