@@ -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
837835object Schema :
0 commit comments