Skip to content

Commit

Permalink
support jackson max token count
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning committed Sep 27, 2024
1 parent a0bcf50 commit a311198
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pekko-http-jackson/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,32 @@ pekko-http-json {
jackson {
jackson-modules += "com.fasterxml.jackson.module.scala.DefaultScalaModule"
read {
# see https://www.javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.16.0/com/fasterxml/jackson/core/StreamReadConstraints.html
# see https://www.javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.18.0/com/fasterxml/jackson/core/StreamReadConstraints.html
# these defaults are the same as the defaults in `StreamReadConstraints`
max-nesting-depth = 1000
max-number-length = 1000
max-string-length = 20000000
# following were added in jackson 2.16.0
# added in jackson 2.16.0
max-name-length = 50000
# max-document-length of -1 means unlimited
# max-document-length of -1 means unlimited (since jackson 2.16.0)
max-document-length = -1
# max-token-count of -1 means unlimited (since jackson 2.18.0)
max-token-count = -1

# see https://www.javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.16.0/com/fasterxml/jackson/core/StreamReadFeature.html
# see https://www.javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.18.0/com/fasterxml/jackson/core/StreamReadFeature.html
# these defaults are the same as the defaults in `StreamReadFeature`
feature {
include-source-in-location = false
}
}
write {
# see https://www.javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.16.0/com/fasterxml/jackson/core/StreamWriteConstraints.html
# see https://www.javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.18.0/com/fasterxml/jackson/core/StreamWriteConstraints.html
# these defaults are the same as the defaults in `StreamWriteConstraints`
max-nesting-depth = 1000
}

# Controls the Buffer Recycler Pool implementation used by Jackson.
# https://javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.16.2/com/fasterxml/jackson/core/util/JsonRecyclerPools.html
# https://javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.18.0/com/fasterxml/jackson/core/util/JsonRecyclerPools.html
# The default is "thread-local" which is the same as the default in Jackson 2.16.
buffer-recycler {
# the supported values are "thread-local", "lock-free", "shared-lock-free", "concurrent-deque",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ object JacksonSupport extends JacksonSupport {
.maxStringLength(config.getInt("read.max-string-length"))
.maxNameLength(config.getInt("read.max-name-length"))
.maxDocumentLength(config.getInt("read.max-document-length"))
.maxTokenCount(config.getInt("read.max-token-count"))
.build()
val streamWriteConstraints = StreamWriteConstraints
.builder()
Expand Down

0 comments on commit a311198

Please sign in to comment.