From 2fd4219af8951134efe986d47a742610b31ef995 Mon Sep 17 00:00:00 2001 From: Hugh Simpson Date: Fri, 2 Aug 2024 12:41:47 +0100 Subject: [PATCH] no idea why I was deriving a circe codec for that enum, doesn't make sense. Removed --- .../src/main/scala/sttp/tapir/codegen/EnumGenerator.scala | 8 ++++---- .../Expected.scala.txt | 2 +- .../oneOf-json-roundtrip_jsoniter_scala3/build.sbt | 1 - 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/openapi-codegen/core/src/main/scala/sttp/tapir/codegen/EnumGenerator.scala b/openapi-codegen/core/src/main/scala/sttp/tapir/codegen/EnumGenerator.scala index 0d48fbb03e..67c594b3be 100644 --- a/openapi-codegen/core/src/main/scala/sttp/tapir/codegen/EnumGenerator.scala +++ b/openapi-codegen/core/src/main/scala/sttp/tapir/codegen/EnumGenerator.scala @@ -33,10 +33,10 @@ object EnumGenerator { val maybeCodecExtensions = jsonSerdeLib match { case _ if !jsonParamRefs.contains(name) && !queryParamRefs.contains(name) => "" case _ if !jsonParamRefs.contains(name) => " derives enumextensions.EnumMirror" - case JsonSerdeLib.Circe | JsonSerdeLib.Jsoniter if !queryParamRefs.contains(name) => - " derives org.latestbit.circe.adt.codec.JsonTaggedAdt.PureCodec" - case JsonSerdeLib.Circe | JsonSerdeLib.Jsoniter => - " derives org.latestbit.circe.adt.codec.JsonTaggedAdt.PureCodec, enumextensions.EnumMirror" + case JsonSerdeLib.Circe if !queryParamRefs.contains(name) => " derives org.latestbit.circe.adt.codec.JsonTaggedAdt.PureCodec" + case JsonSerdeLib.Circe => " derives org.latestbit.circe.adt.codec.JsonTaggedAdt.PureCodec, enumextensions.EnumMirror" + case JsonSerdeLib.Jsoniter if !queryParamRefs.contains(name) => "" + case JsonSerdeLib.Jsoniter => " derives enumextensions.EnumMirror" case JsonSerdeLib.Zio if !queryParamRefs.contains(name) => s" extends java.lang.Enum[$name]" case JsonSerdeLib.Zio => s" extends java.lang.Enum[$name] derives enumextensions.EnumMirror" } diff --git a/openapi-codegen/sbt-plugin/src/sbt-test/sbt-openapi-codegen/oneOf-json-roundtrip_jsoniter_scala3/Expected.scala.txt b/openapi-codegen/sbt-plugin/src/sbt-test/sbt-openapi-codegen/oneOf-json-roundtrip_jsoniter_scala3/Expected.scala.txt index e0e0bef124..e57d874760 100644 --- a/openapi-codegen/sbt-plugin/src/sbt-test/sbt-openapi-codegen/oneOf-json-roundtrip_jsoniter_scala3/Expected.scala.txt +++ b/openapi-codegen/sbt-plugin/src/sbt-test/sbt-openapi-codegen/oneOf-json-roundtrip_jsoniter_scala3/Expected.scala.txt @@ -75,7 +75,7 @@ object TapirGeneratedEndpoints { a: Option[Seq[String]] = None ) extends ADTWithDiscriminator with ADTWithDiscriminatorNoMapping - enum AnEnum derives org.latestbit.circe.adt.codec.JsonTaggedAdt.PureCodec { + enum AnEnum { case Foo, Bar, Baz } diff --git a/openapi-codegen/sbt-plugin/src/sbt-test/sbt-openapi-codegen/oneOf-json-roundtrip_jsoniter_scala3/build.sbt b/openapi-codegen/sbt-plugin/src/sbt-test/sbt-openapi-codegen/oneOf-json-roundtrip_jsoniter_scala3/build.sbt index fa1bd911d6..68ba848ef7 100644 --- a/openapi-codegen/sbt-plugin/src/sbt-test/sbt-openapi-codegen/oneOf-json-roundtrip_jsoniter_scala3/build.sbt +++ b/openapi-codegen/sbt-plugin/src/sbt-test/sbt-openapi-codegen/oneOf-json-roundtrip_jsoniter_scala3/build.sbt @@ -11,7 +11,6 @@ libraryDependencies ++= Seq( "com.softwaremill.sttp.tapir" %% "tapir-openapi-docs" % "1.10.0", "com.softwaremill.sttp.apispec" %% "openapi-circe-yaml" % "0.8.0", "com.beachape" %% "enumeratum" % "1.7.4", - "org.latestbit" %% "circe-tagged-adt-codec" % "0.11.0", "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % "2.30.7", "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.30.7" % "compile-internal", "org.scalatest" %% "scalatest" % "3.2.19" % Test,