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

add LoaderOptions doc to README #396

Merged
merged 2 commits into from
Mar 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions yaml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To use this extension on Maven-based projects, use following dependency:
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.13.4</version>
<version>2.14.2</version>
</dependency>
```

Expand Down Expand Up @@ -60,7 +60,20 @@ while (parser.nextToken() != null) {
Most configuration is applied during mapper instance configuration, through
`YAMLMapper.Builder`, similar to how JSON-based plain `ObjectMapper` is configured.

## Known problems
### SnakeYAML Configuration

Since jackson-dataformat-yaml 2.14, it is possible to configure the underlying [SnakeYAML](https://bitbucket.org/snakeyaml/snakeyaml/wiki/Home) behavior.

If you are parsing YAML, you might consider configuring the
[LoaderOptions](https://www.javadoc.io/doc/org.yaml/snakeyaml/latest/org/yaml/snakeyaml/LoaderOptions.html).
See the related 'Known Problems' section below to see an example of how to do this. As well as configuring the
'codePointLimit', you might also want to configure the 'nestingDepthLimit'.

If you are generating YAML, you can also control the underlying SnakeYAML behavior by
setting the [DumperOptions](https://www.javadoc.io/doc/org.yaml/snakeyaml/latest/org/yaml/snakeyaml/DumperOptions.html)
on the [YAMLFactory.builder()](https://javadoc.io/static/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.14.2/com/fasterxml/jackson/dataformat/yaml/YAMLFactoryBuilder.html).

## Known Problems

### Maximum input YAML document size (3 MB)

Expand Down