Skip to content

Commit c114332

Browse files
committed
Update release notes wrt #337
1 parent 444e62c commit c114332

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

release-notes/VERSION-2.x

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ Active Maintainers:
3131
(contributed by @pjfanning)
3232
#335: (yaml) Update to SnakeYAML 1.32
3333
(contributed by @pjfanning)
34+
#337: (yaml) Allow overriding of file size limit for YAMLParser by exposing
35+
SnakeYAML `LoaderOptions`
36+
(contributed by @pjfanning)
3437
* (yaml) Fixes to number decoding based on oss-fuzz findings
3538

3639
2.13.5 (not yet released)

yaml/README.md

+34-4
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,61 @@ To use this extension on Maven-based projects, use following dependency:
2222
<dependency>
2323
<groupId>com.fasterxml.jackson.dataformat</groupId>
2424
<artifactId>jackson-dataformat-yaml</artifactId>
25-
<version>2.8.3</version>
25+
<version>2.13.4</version>
2626
</dependency>
2727
```
2828

2929
# Usage
3030

3131
## Simple usage
3232

33-
Usage is as with basic `JsonFactory`; most commonly you will just construct a standard `ObjectMapper` with `com.fasterxml.jackson.dataformat.yaml.YAMLFactory`, like so:
33+
Usage is through basic `JsonFactory` and/or `ObjectMapper` API but you will construct instances differently:
3434

3535
```java
36-
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
36+
// Mapper with default configuration
37+
ObjectMapper mapper = new YAMLMapper();
3738
User user = mapper.readValue(yamlSource, User.class);
39+
40+
// Or using builder
41+
ObjectMapper mapper = YAMLMapper.builder()
42+
.disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER)
43+
.build();
44+
Json
45+
3846
```
3947

4048
but you can also just use underlying `YAMLFactory` and parser it produces, for event-based processing:
4149

4250
```java
4351
YAMLFactory factory = new YAMLFactory();
44-
JsonParser parser = factory.createJsonParser(yamlString); // don't be fooled by method name...
52+
JsonParser parser = factory.createParser(yamlString); // don't be fooled by method name...
4553
while (parser.nextToken() != null) {
4654
// do something!
4755
}
4856
```
4957

58+
## Configuration
59+
60+
Most configuration is applied during mapper instance configuration, through
61+
`YAMLMapper.Builder`, similar to how JSON-based plain `ObjectMapper` is configured.
62+
63+
## Known problems
64+
65+
### Maximum input YAML document size (3 MB)
66+
67+
SnakeYAML implementation starts imposing the default limit of 3 megabyte document
68+
size as of version 1.32, used by Jackson 2.14.0. If you hit this limitation,
69+
you need to explicitly increase the limit by configuring `YAMLFactory` and constructing `YAMLMapper` with that:
70+
71+
```java
72+
LoaderOptions loaderOptions = new LoaderOptions();
73+
loaderOptions.setCodePointLimit(10 * 1024 * 1024); // 10 MB
74+
YAMLFactory yamlFactory = YAMLFactory.builder()
75+
.loaderOptions(loaderOptions)
76+
.build();
77+
YAMLMapper mapper = new YAMLMapper(yamlFactory);
78+
```
79+
5080
# Documentation
5181

5282
* [Wiki](../../../wiki) contains links to Javadocs, external documentation

0 commit comments

Comments
 (0)