From 8001cb920715eb255a4862fdaae46132cd2ae49e Mon Sep 17 00:00:00 2001 From: Hugh Simpson Date: Tue, 6 Aug 2024 08:25:10 +0100 Subject: [PATCH] use correct CodecFormat, so that output swagger matches --- .../src/main/scala/sttp/tapir/codegen/EndpointGenerator.scala | 2 +- .../oneOf-json-roundtrip/Expected.scala.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openapi-codegen/core/src/main/scala/sttp/tapir/codegen/EndpointGenerator.scala b/openapi-codegen/core/src/main/scala/sttp/tapir/codegen/EndpointGenerator.scala index 2e66241867..400ac50df6 100644 --- a/openapi-codegen/core/src/main/scala/sttp/tapir/codegen/EndpointGenerator.scala +++ b/openapi-codegen/core/src/main/scala/sttp/tapir/codegen/EndpointGenerator.scala @@ -382,7 +382,7 @@ class EndpointGenerator { case StreamingImplementation.Pekko => "sttp.capabilities.pekko.PekkoStreams" case StreamingImplementation.Zio => "sttp.capabilities.zio.ZioStreams" } - s"streamTextBody($capability)(CodecFormat.TextPlain())" + s"streamTextBody($capability)(CodecFormat.OctetStream())" case x => bail(s"$contentType only supports binary schema. Found $x") } diff --git a/openapi-codegen/sbt-plugin/src/sbt-test/sbt-openapi-codegen/oneOf-json-roundtrip/Expected.scala.txt b/openapi-codegen/sbt-plugin/src/sbt-test/sbt-openapi-codegen/oneOf-json-roundtrip/Expected.scala.txt index 1ed8446f74..454c390615 100644 --- a/openapi-codegen/sbt-plugin/src/sbt-test/sbt-openapi-codegen/oneOf-json-roundtrip/Expected.scala.txt +++ b/openapi-codegen/sbt-plugin/src/sbt-test/sbt-openapi-codegen/oneOf-json-roundtrip/Expected.scala.txt @@ -123,13 +123,13 @@ object TapirGeneratedEndpoints { endpoint .get .in(("binary" / "test")) - .out(streamTextBody(sttp.capabilities.pekko.PekkoStreams)(CodecFormat.TextPlain()).description("Response CSV body")) + .out(streamTextBody(sttp.capabilities.pekko.PekkoStreams)(CodecFormat.OctetStream()).description("Response CSV body")) lazy val postBinaryTest = endpoint .post .in(("binary" / "test")) - .in(streamTextBody(sttp.capabilities.pekko.PekkoStreams)(CodecFormat.TextPlain())) + .in(streamTextBody(sttp.capabilities.pekko.PekkoStreams)(CodecFormat.OctetStream())) .out(jsonBody[String].description("successful operation")) lazy val putAdtTest =