From f3bd899f53170365fffd05ee586390263f3475d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20K=C3=A5veland?= Date: Fri, 8 Nov 2024 11:18:31 +0100 Subject: [PATCH] Add test case for tapir jsonitor max char size --- .../scala/caliban/interop/tapir/TapirAdapterSpec.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/interop/tapir/src/test/scala/caliban/interop/tapir/TapirAdapterSpec.scala b/interop/tapir/src/test/scala/caliban/interop/tapir/TapirAdapterSpec.scala index f3388256b..91d664c67 100644 --- a/interop/tapir/src/test/scala/caliban/interop/tapir/TapirAdapterSpec.scala +++ b/interop/tapir/src/test/scala/caliban/interop/tapir/TapirAdapterSpec.scala @@ -3,7 +3,7 @@ package caliban.interop.tapir import caliban.InputValue.ObjectValue import caliban.Value.StringValue import caliban._ -import com.github.plokhotnyuk.jsoniter_scala.core.{ readFromString, writeToString, JsonValueCodec } +import com.github.plokhotnyuk.jsoniter_scala.core.{ readFromString, writeToString, JsonValueCodec, ReaderConfig } import com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodecMaker import sttp.capabilities.zio.ZioStreams import sttp.capabilities.{ Effect, WebSockets } @@ -272,6 +272,13 @@ object TapirAdapterSpec { method = Method.GET.method, query = """mutation{ deleteCharacter(name: "Amos Burton") }""" ).map(r => assertTrue(r.code.code == 400)) + }, + test("very long field values in mutations") { + val name = "A".repeat(ReaderConfig.maxCharBufSize + 1) + runHttpRequest( + method = Method.POST.method, + query = s"mutation { deleteCharacter(name: \"$name\") }" + ).map(r => assertTrue(r.code.code == 200)) } ) ),