Skip to content

Commit 897ba8f

Browse files
committed
fix enum type names containing scala keywords
1 parent e723d54 commit 897ba8f

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

build.sbt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,17 @@ lazy val noPublish = Seq(
4040
publish / skip := true
4141
)
4242

43-
lazy val sttpClient4Version = "4.0.11"
43+
val sttpClient4Version = "4.0.13"
4444

45-
lazy val zioVersion = "2.1.21"
45+
val zioVersion = "2.1.22"
4646

47-
lazy val zioJsonVersion = "0.7.44"
47+
val zioJsonVersion = "0.7.45"
4848

49-
lazy val jsoniterVersion = "2.38.2"
49+
val jsoniterVersion = "2.38.4"
5050

51-
lazy val munitVersion = "1.2.0"
51+
val munitVersion = "1.2.1"
52+
53+
val upickleVersion = "4.4.1"
5254

5355
addCommandAlias("fmt", "all scalafmtSbt scalafmt test:scalafmt")
5456

@@ -77,7 +79,7 @@ lazy val core = crossProject(JVMPlatform, NativePlatform)
7779
)
7880
.settings(
7981
libraryDependencies ++= Seq(
80-
"com.lihaoyi" %%% "upickle" % "4.1.0"
82+
"com.lihaoyi" %%% "upickle" % upickleVersion
8183
)
8284
)
8385

modules/cli/src/main/scala/cli.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// for test runs using scala-cli
22
//> using jvm system
3-
//> using scala 3.7.3
3+
//> using scala 3.7.4
44
//> using file ../../../../core/shared/src/main/scala/codegen.scala
5-
//> using dep com.lihaoyi::upickle:4.3.2
5+
//> using dep com.lihaoyi::upickle:4.4.1
66

77
package gcp.codegen.cli
88

modules/core/shared/src/main/scala/codegen.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def schemasCode(
440440
val scalaName = s.id.scalaName
441441
s"""|case class $scalaName(
442442
|${s
443-
.scalaProperties(hasProps)
443+
.sortedProperties(hasProps)
444444
.map { (n, t) =>
445445
val enumType =
446446
if jsonCodec == JsonCodec.ZioJson then SchemaType.EnumType.Literal
@@ -483,7 +483,7 @@ def commonSchemaCodecs(
483483
case (JsonCodec.Jsoniter, ArrayType.ZioChunk) =>
484484
schemas.toList
485485
.flatMap((sk, sv) =>
486-
sv.scalaProperties(hasProps)
486+
sv.sortedProperties(hasProps)
487487
.collect { case (k, Property(_, SchemaType.Array(typ, _), _)) =>
488488
val enumType =
489489
if jsonCodec == JsonCodec.ZioJson then SchemaType.EnumType.Literal
@@ -817,14 +817,12 @@ case class Schema(
817817

818818
// required properties first
819819
// references wihout properties are excluded
820-
private def sortedProps(hasProps: SchemaPath => Boolean): List[(String, Property)] =
820+
def sortedProperties(hasProps: SchemaPath => Boolean): List[(String, Property)] =
821821
properties
822822
.filter { (_, prop) =>
823823
prop.schemaPath.forall(hasProps(_))
824824
}
825825
.sortBy(_._2.typ.optional)
826-
def scalaProperties(hasProps: SchemaPath => Boolean): List[(String, Property)] =
827-
sortedProps(hasProps).map { (k, prop) => (toScalaName(k), prop) }
828826
}
829827

830828
object Schema:

0 commit comments

Comments
 (0)