Skip to content

Commit

Permalink
jackson 2.18.1 with max-token-count support
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning committed Nov 9, 2024
1 parent e21fa9e commit 6340ebb
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .scala-steward.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
updates.pin = [
{ groupId = "com.fasterxml.jackson.core", version = "2.17." }
# Jackson upgrades can be complicated to coordinate across modules - it is better to upgrade manually
{ groupId = "com.fasterxml.jackson.core", version = "2.18." }
# Pin logback to v1.3.x because v1.4.x needs JDK11
{ groupId = "ch.qos.logback", version="1.3." }
# Pin sbt-paradox to v0.9.x because 0.10.x needs JDK 11
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object Dependencies {
val nettyVersion = "4.1.114.Final"
val logbackVersion = "1.3.14"

val jacksonCoreVersion = "2.17.3"
val jacksonCoreVersion = "2.18.1"
val jacksonDatabindVersion = jacksonCoreVersion

val scala212Version = "2.12.20"
Expand Down
2 changes: 2 additions & 0 deletions serialization-jackson/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ pekko.serialization.jackson {
max-name-length = 50000
# max-document-length of -1 means unlimited
max-document-length = -1
# max-token-count of -1 means unlimited
max-token-count = -1
}

write {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ object JacksonObjectMapperProvider extends ExtensionId[JacksonObjectMapperProvid
.maxStringLength(config.getInt("read.max-string-length"))
.maxNameLength(config.getInt("read.max-name-length"))
.maxDocumentLength(config.getLong("read.max-document-length"))
.maxTokenCount(config.getLong("read.max-token-count"))
.build()

val streamWriteConstraints = StreamWriteConstraints.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ class JacksonFactorySpec extends TestKit(ActorSystem("JacksonFactorySpec"))
val maxStringLen = 1234567
val maxDocLen = 123456789L
val maxNestingDepth = 5
val maxTokenCount = 9876543210L
val config = ConfigFactory.parseString(
s"""pekko.serialization.jackson.read.max-number-length=$maxNumLen
|pekko.serialization.jackson.read.max-string-length=$maxStringLen
|pekko.serialization.jackson.read.max-document-length=$maxDocLen
|pekko.serialization.jackson.read.max-nesting-depth=$maxNestingDepth
|pekko.serialization.jackson.read.max-token-count=$maxTokenCount
|""".stripMargin)
.withFallback(defaultConfig)
val jacksonConfig = JacksonObjectMapperProvider.configForBinding(bindingName, config)
Expand All @@ -60,6 +62,7 @@ class JacksonFactorySpec extends TestKit(ActorSystem("JacksonFactorySpec"))
streamReadConstraints.getMaxStringLength shouldEqual maxStringLen
streamReadConstraints.getMaxDocumentLength shouldEqual maxDocLen
streamReadConstraints.getMaxNestingDepth shouldEqual maxNestingDepth
streamReadConstraints.getMaxTokenCount shouldEqual maxTokenCount
}

"support StreamWriteConstraints" in {
Expand Down

0 comments on commit 6340ebb

Please sign in to comment.