@@ -26,10 +26,13 @@ import com.fasterxml.jackson.databind.SerializationFeature
26
26
import com.fasterxml.jackson.databind.json.JsonMapper
27
27
import com.fasterxml.jackson.databind.node.MissingNode
28
28
import com.fasterxml.jackson.dataformat.xml.XmlMapper
29
+ import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
29
30
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper
30
31
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
31
32
import com.fasterxml.jackson.module.kotlin.registerKotlinModule
32
33
34
+ import org.yaml.snakeyaml.LoaderOptions
35
+
33
36
val PROPERTY_NAMING_STRATEGY = PropertyNamingStrategies .SNAKE_CASE as PropertyNamingStrategies .NamingBase
34
37
35
38
/* *
@@ -46,6 +49,15 @@ val mapperConfig: ObjectMapper.() -> Unit = {
46
49
47
50
val jsonMapper = JsonMapper ().apply (mapperConfig)
48
51
val xmlMapper = XmlMapper ().apply (mapperConfig)
49
- val yamlMapper = YAMLMapper ().apply (mapperConfig)
52
+
53
+ private val loaderOptions = LoaderOptions ().apply {
54
+ // Set the code point limit to 1GB, required since SnakeYAML 1.32. Also see:
55
+ // https://github.com/FasterXML/jackson-dataformats-text/tree/2.15/yaml#maximum-input-yaml-document-size-3-mb
56
+ // https://github.com/FasterXML/jackson-dataformats-text/issues/337
57
+ // TODO: Consider making this configurable.
58
+ codePointLimit = 1024 * 1024 * 1024
59
+ }
60
+ private val yamlFactory = YAMLFactory .builder().loaderOptions(loaderOptions).build()
61
+ val yamlMapper = YAMLMapper (yamlFactory).apply (mapperConfig)
50
62
51
63
val EMPTY_JSON_NODE : JsonNode = MissingNode .getInstance()
0 commit comments