Skip to content

Commit d58909d

Browse files
committed
Merge branch 'master' into update-api-specs
2 parents 3da3636 + d90265e commit d58909d

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ val zioVersion = "2.1.22"
4646

4747
val zioJsonVersion = "0.7.45"
4848

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

5151
val munitVersion = "1.2.1"
5252

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,12 @@ def schemasCode(
447447
val scalaName = s.id.scalaName
448448
s"""|case class $scalaName(
449449
|${s
450-
.scalaProperties(hasProps)
450+
.sortedProperties(hasProps)
451451
.map { (n, t) =>
452452
val enumType =
453453
if jsonCodec == JsonCodec.ZioJson then SchemaType.EnumType.Literal
454454
else SchemaType.EnumType.Nominal(s"$scalaName.${toScalaTypeName(n)}")
455-
s"${toComment(t.withTypeDescription)} $n: ${
455+
s"${toComment(t.withTypeDescription)} ${toScalaName(n)}: ${
456456
(if (t.optional) s"${t.scalaType(arrType, enumType)} = None" else t.scalaType(arrType, enumType))
457457
}"
458458
}
@@ -490,7 +490,7 @@ def commonSchemaCodecs(
490490
case (JsonCodec.Jsoniter, ArrayType.ZioChunk) =>
491491
schemas.toList
492492
.flatMap((sk, sv) =>
493-
sv.scalaProperties(hasProps)
493+
sv.sortedProperties(hasProps)
494494
.collect { case (k, Property(_, SchemaType.Array(typ, _), _)) =>
495495
val enumType =
496496
if jsonCodec == JsonCodec.ZioJson then SchemaType.EnumType.Literal
@@ -824,14 +824,12 @@ case class Schema(
824824

825825
// required properties first
826826
// references wihout properties are excluded
827-
private def sortedProps(hasProps: SchemaPath => Boolean): List[(String, Property)] =
827+
def sortedProperties(hasProps: SchemaPath => Boolean): List[(String, Property)] =
828828
properties
829829
.filter { (_, prop) =>
830830
prop.schemaPath.forall(hasProps(_))
831831
}
832832
.sortBy(_._2.typ.optional)
833-
def scalaProperties(hasProps: SchemaPath => Boolean): List[(String, Property)] =
834-
sortedProps(hasProps).map { (k, prop) => (toScalaName(k), prop) }
835833
}
836834

837835
object Schema:

0 commit comments

Comments
 (0)