Skip to content

Commit 08ac04b

Browse files
committed
Bugfix: Remove the snake case renaming from derivations because they're not used anymore
1 parent 3c09834 commit 08ac04b

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ScalaOptions._
33

44
organization in ThisBuild := "com.enfore"
55
ThisBuild / crossScalaVersions := supportedVersions
6-
version in ThisBuild := "unstable-SNAPSHOT"
6+
version in ThisBuild := "1.3.5"
77
fork in Test in ThisBuild := true
88

99
lazy val http4s = Seq(http4sCore, http4sDsl, http4sCirce, http4sServer)

openapi-scala/src/main/scala/com/enfore/apis/generator/ScalaGenerator.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ object ScalaGenerator {
185185
)
186186
.mkString("(\n\t", ",\n\t", "\n)")} \n
187187
|object $typeName {
188-
|\timplicit val customConfig = Configuration.default.withDefaults
189-
|\timplicit val circeDecoder: Decoder[$typeName] = deriveDecoder[$typeName](renaming.snakeCase, true, None)
190-
|\timplicit val circeEncoder: Encoder[$typeName] = deriveEncoder[$typeName](renaming.snakeCase, None)${refinedCode
188+
|\timplicit val customConfig = Configuration.default.withDefaults.withSnakeCaseMemberNames.withSnakeCaseConstructorNames
189+
|\timplicit val circeDecoder: Decoder[$typeName] = deriveDecoder[$typeName]
190+
|\timplicit val circeEncoder: Encoder[$typeName] = deriveEncoder[$typeName]${refinedCode
191191
.getOrElse("")}
192192
|}
193193
""".stripMargin.trim

openapi-scala/src/test/scala/com/enfore/apis/generator/ComponentsTypeReprSpec.scala

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class ComponentsTypeReprSpec extends AnyFlatSpec with Matchers {
3838
|final case class Person(name: String, age: Int)
3939
|
4040
|object Person {
41-
| implicit val customConfig = Configuration.default.withDefaults
42-
| implicit val circeDecoder: Decoder[Person] = deriveDecoder[Person](renaming.snakeCase, true, None)
43-
| implicit val circeEncoder: Encoder[Person] = deriveEncoder[Person](renaming.snakeCase, None)
41+
| implicit val customConfig = Configuration.default.withDefaults.withSnakeCaseMemberNames.withSnakeCaseConstructorNames
42+
| implicit val circeDecoder: Decoder[Person] = deriveDecoder[Person]
43+
| implicit val circeEncoder: Encoder[Person] = deriveEncoder[Person]
4444
|}
4545
""".stripMargin.trim.parse[Source]
4646
val tree: Parsed[Source] = ScalaGenerator.codeGenerator.generateScala(person).parse[Source]
@@ -69,9 +69,9 @@ class ComponentsTypeReprSpec extends AnyFlatSpec with Matchers {
6969
|final case class Person()
7070
|
7171
|object Person {
72-
| implicit val customConfig = Configuration.default.withDefaults
73-
| implicit val circeDecoder: Decoder[Person] = deriveDecoder[Person](renaming.snakeCase, true, None)
74-
| implicit val circeEncoder: Encoder[Person] = deriveEncoder[Person](renaming.snakeCase, None)
72+
| implicit val customConfig = Configuration.default.withDefaults.withSnakeCaseMemberNames.withSnakeCaseConstructorNames
73+
| implicit val circeDecoder: Decoder[Person] = deriveDecoder[Person]
74+
| implicit val circeEncoder: Encoder[Person] = deriveEncoder[Person]
7575
|}
7676
""".stripMargin.trim.parse[Source]
7777
val tree: Parsed[Source] = ScalaGenerator.codeGenerator.generateScala(person).parse[Source]
@@ -103,9 +103,9 @@ class ComponentsTypeReprSpec extends AnyFlatSpec with Matchers {
103103
|final case class Person(name: com.enfore.apis.Name, age: Int)
104104
|
105105
|object Person {
106-
| implicit val customConfig = Configuration.default.withDefaults
107-
| implicit val circeDecoder: Decoder[Person] = deriveDecoder[Person](renaming.snakeCase, true, None)
108-
| implicit val circeEncoder: Encoder[Person] = deriveEncoder[Person](renaming.snakeCase, None)
106+
| implicit val customConfig = Configuration.default.withDefaults.withSnakeCaseMemberNames.withSnakeCaseConstructorNames
107+
| implicit val circeDecoder: Decoder[Person] = deriveDecoder[Person]
108+
| implicit val circeEncoder: Encoder[Person] = deriveEncoder[Person]
109109
|}
110110
""".stripMargin.trim.parse[Source]
111111
val tree: Parsed[Source] = ScalaGenerator.codeGenerator.generateScala(person).parse[Source]
@@ -160,9 +160,9 @@ class ComponentsTypeReprSpec extends AnyFlatSpec with Matchers {
160160
|final case class Person(name: com.enfore.apis.Name = com.enfore.apis.Name.MAGIC, age: Int)
161161
|
162162
|object Person {
163-
| implicit val customConfig = Configuration.default.withDefaults
164-
| implicit val circeDecoder: Decoder[Person] = deriveDecoder[Person](renaming.snakeCase, true, None)
165-
| implicit val circeEncoder: Encoder[Person] = deriveEncoder[Person](renaming.snakeCase, None)
163+
| implicit val customConfig = Configuration.default.withDefaults.withSnakeCaseMemberNames.withSnakeCaseConstructorNames
164+
| implicit val circeDecoder: Decoder[Person] = deriveDecoder[Person]
165+
| implicit val circeEncoder: Encoder[Person] = deriveEncoder[Person]
166166
|}
167167
""".stripMargin.trim.parse[Source]
168168
val tree: Parsed[Source] = ScalaGenerator.codeGenerator.generateScala(person).parse[Source]
@@ -202,9 +202,9 @@ class ComponentsTypeReprSpec extends AnyFlatSpec with Matchers {
202202
| listOpVal: List[Option[Double]])
203203
|
204204
| object ParamedType {
205-
| implicit val customConfig = Configuration.default.withDefaults
206-
| implicit val circeDecoder: Decoder[ParamedType] = deriveDecoder[ParamedType](renaming.snakeCase, true, None)
207-
| implicit val circeEncoder: Encoder[ParamedType] = deriveEncoder[ParamedType](renaming.snakeCase, None)
205+
| implicit val customConfig = Configuration.default.withDefaults.withSnakeCaseMemberNames.withSnakeCaseConstructorNames
206+
| implicit val circeDecoder: Decoder[ParamedType] = deriveDecoder[ParamedType]
207+
| implicit val circeEncoder: Encoder[ParamedType] = deriveEncoder[ParamedType]
208208
| }
209209
""".stripMargin.trim.parse[Source]
210210
val tree: Parsed[Source] = ScalaGenerator.codeGenerator.generateScala(paramedType).parse[Source]
@@ -244,9 +244,9 @@ class ComponentsTypeReprSpec extends AnyFlatSpec with Matchers {
244244
|final case class RefinedType(stringVal : String Refined AllOf[MinSize[W.`3`.T] :: MaxSize[W.`3`.T] :: HNil])
245245
|
246246
|object RefinedType {
247-
| implicit val customConfig = Configuration.default.withDefaults
248-
| implicit val circeDecoder: Decoder[RefinedType] = deriveDecoder[RefinedType](renaming.snakeCase, true, None)
249-
| implicit val circeEncoder: Encoder[RefinedType] = deriveEncoder[RefinedType](renaming.snakeCase, None)
247+
| implicit val customConfig = Configuration.default.withDefaults.withSnakeCaseMemberNames.withSnakeCaseConstructorNames
248+
| implicit val circeDecoder: Decoder[RefinedType] = deriveDecoder[RefinedType]
249+
| implicit val circeEncoder: Encoder[RefinedType] = deriveEncoder[RefinedType]
250250
| object RefinementConstructors {
251251
| val stringVal = new RefinedTypeOps[String Refined AllOf[MinSize[W.`3`.T] :: MaxSize[W.`3`.T] :: HNil], String]
252252
| }
@@ -292,8 +292,8 @@ class ComponentsTypeReprSpec extends AnyFlatSpec with Matchers {
292292
|)
293293
|
294294
|object RefinedType {
295-
| implicit val circeDecoder: Decoder[RefinedType] = deriveDecoder[RefinedType](renaming.snakeCase, true, None)
296-
| implicit val circeEncoder: Encoder[RefinedType] = deriveEncoder[RefinedType](renaming.snakeCase, None)
295+
| implicit val circeDecoder: Decoder[RefinedType] = deriveDecoder[RefinedType]
296+
| implicit val circeEncoder: Encoder[RefinedType] = deriveEncoder[RefinedType]
297297
|
298298
|object RefinementConstructors {
299299
| val intVal = new RefinedTypeOps[Int Refined AllOf[GreaterEqual[10] :: LessEqual[15] :: HNil], Int]
@@ -342,9 +342,9 @@ class ComponentsTypeReprSpec extends AnyFlatSpec with Matchers {
342342
|final case class RefinedType(listString : List[String] Refined AllOf[MinSize[W.`3`.T] :: MaxSize[W.`3`.T] :: HNil])
343343
|
344344
|object RefinedType {
345-
| implicit val customConfig = Configuration.default.withDefaults
346-
| implicit val circeDecoder: Decoder[RefinedType] = deriveDecoder[RefinedType](renaming.snakeCase, true, None)
347-
| implicit val circeEncoder: Encoder[RefinedType] = deriveEncoder[RefinedType](renaming.snakeCase, None)
345+
| implicit val customConfig = Configuration.default.withDefaults.withSnakeCaseMemberNames.withSnakeCaseConstructorNames
346+
| implicit val circeDecoder: Decoder[RefinedType] = deriveDecoder[RefinedType]
347+
| implicit val circeEncoder: Encoder[RefinedType] = deriveEncoder[RefinedType]
348348
| object RefinementConstructors {
349349
| val listString = new RefinedTypeOps[List[String] Refined AllOf[MinSize[W.`3`.T] :: MaxSize[W.`3`.T] :: HNil], List[String]]
350350
| }
@@ -392,9 +392,9 @@ class ComponentsTypeReprSpec extends AnyFlatSpec with Matchers {
392392
|final case class RefinedType(nested : Option[String Refined AllOf[MinSize[W.`2`.T] :: MaxSize[W.`2`.T] :: HNil]])
393393
|
394394
| object RefinedType {
395-
| implicit val customConfig = Configuration.default.withDefaults
396-
| implicit val circeDecoder: Decoder[RefinedType] = deriveDecoder[RefinedType](renaming.snakeCase, true, None)
397-
| implicit val circeEncoder: Encoder[RefinedType] = deriveEncoder[RefinedType](renaming.snakeCase, None)
395+
| implicit val customConfig = Configuration.default.withDefaults.withSnakeCaseMemberNames.withSnakeCaseConstructorNames
396+
| implicit val circeDecoder: Decoder[RefinedType] = deriveDecoder[RefinedType]
397+
| implicit val circeEncoder: Encoder[RefinedType] = deriveEncoder[RefinedType]
398398
|
399399
|
400400
| object RefinementConstructors {

0 commit comments

Comments
 (0)