Skip to content

Commit 340bec3

Browse files
authored
Merge pull request #25 from rolang/fix/reading-missing-props
fix reading schema with missing properties, improve error log
2 parents fe37f09 + 34ff427 commit 340bec3

5 files changed

Lines changed: 11382 additions & 7 deletions

File tree

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ThisBuild / description := "Google Cloud client code generator"
22
ThisBuild / organization := "dev.rolang"
33
ThisBuild / licenses := Seq(License.MIT)
44
ThisBuild / homepage := Some(url("https://github.com/rolang/google-rest-api-codegen"))
5-
ThisBuild / scalaVersion := "3.7.4"
5+
ThisBuild / scalaVersion := "3.8.2"
66
ThisBuild / version ~= { v => if (v.contains('+')) s"${v.replace('+', '-')}-SNAPSHOT" else v }
77
ThisBuild / versionScheme := Some("early-semver")
88
ThisBuild / scmInfo := Some(
@@ -50,7 +50,7 @@ val jsoniterVersion = "2.38.8"
5050

5151
val munitVersion = "1.2.1"
5252

53-
val upickleVersion = "4.4.2"
53+
val upickleVersion = "4.4.3"
5454

5555
addCommandAlias("fmt", "all scalafmtSbt scalafmt test:scalafmt")
5656

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

Lines changed: 4 additions & 3 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.4
3+
//> using scala 3.8.2
44
//> using file ../../../../core/shared/src/main/scala/codegen.scala
5-
//> using dep com.lihaoyi::upickle:4.4.2
5+
//> using dep com.lihaoyi::upickle:4.4.3
66

77
package gcp.codegen.cli
88

@@ -26,7 +26,8 @@ import scala.concurrent.duration.*
2626
sys.exit(0)
2727
catch
2828
case err: Throwable =>
29-
Console.err.println(s"Failure: ${err.getMessage()}")
29+
Console.err.println(s"Failure on code generation: ${err.getMessage()}")
30+
err.printStackTrace(Console.err)
3031
sys.exit(1)
3132

3233
private def argsToTask(args: Seq[String]): Either[String, Task] =

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ object Schema:
806806
Schema(
807807
id = name,
808808
description = data.value.get("description").map(_.str),
809-
properties = readProps(data("properties").obj, name.add("properties"))
809+
properties = data.value.get("properties").map(_.obj).map(readProps(_, name.add("properties"))).getOrElse(Nil)
810810
)
811811

812812
def readSchemas(o: ujson.Obj): Map[SchemaPath, Schema] = {

0 commit comments

Comments
 (0)