From fdc00356b2dd109f36bbbb15ab5257d791ace9da Mon Sep 17 00:00:00 2001 From: Ben Iofel Date: Thu, 2 Mar 2023 00:14:17 -0500 Subject: [PATCH] Bump scala and sbt version (#185) --- .github/workflows/ci.yml | 4 +++- .travis.yml | 5 +++-- build.sbt | 4 ++-- project/build.properties | 2 +- src/main/scala/io/apibuilder/util/UnionToModelBuilder.scala | 2 +- src/main/scala/io/apibuilder/validation/AnyType.scala | 2 +- .../scala/io/apibuilder/util/UnionToModelBuilderSpec.scala | 2 +- .../scala/io/apibuilder/validation/ApiBuilderTypeSpec.scala | 2 +- .../scala/io/apibuilder/validation/helpers/Helpers.scala | 2 +- 9 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0ed19d..46baec3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: java: [ '13' ] - scala: [ '2.13.6' ] + scala: [ '2.13.10' ] steps: - uses: actions/checkout@v2 - name: Set up JDK @@ -24,5 +24,7 @@ jobs: distribution: 'zulu' - name: print Java version run: java -version + - name: setup apibuilder config + run: mkdir ~/.apibuilder && echo "[default]" > ~/.apibuilder/config - name: Build run: sbt ++${{ matrix.scala }} clean test diff --git a/.travis.yml b/.travis.yml index 0d7bde4..499db2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,10 @@ language: scala scala: - - 2.13.6 + - 2.13.10 jdk: - openjdk13 -script: +script: + - mkdir ~/.apibuilder && echo "[default]" > ~/.apibuilder/config - sbt ++$TRAVIS_SCALA_VERSION clean compile test # Tricks to avoid unnecessary cache updates - find $HOME/.sbt -name "*.lock" | xargs rm -f diff --git a/build.sbt b/build.sbt index a66c082..c06412b 100644 --- a/build.sbt +++ b/build.sbt @@ -2,9 +2,9 @@ name := "apibuilder-validation" organization := "io.apibuilder" -ThisBuild / scalaVersion := "2.13.6" +ThisBuild / scalaVersion := "2.13.10" -crossScalaVersions := Seq("2.13.6") +crossScalaVersions := Seq("2.13.10") lazy val allScalacOptions = Seq( "-deprecation", diff --git a/project/build.properties b/project/build.properties index baf5ff3..46e43a9 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.7 +sbt.version=1.8.2 diff --git a/src/main/scala/io/apibuilder/util/UnionToModelBuilder.scala b/src/main/scala/io/apibuilder/util/UnionToModelBuilder.scala index 71c3eb2..3824094 100644 --- a/src/main/scala/io/apibuilder/util/UnionToModelBuilder.scala +++ b/src/main/scala/io/apibuilder/util/UnionToModelBuilder.scala @@ -45,7 +45,7 @@ case class UnionToModelBuilder(multiService: MultiService) { } private[this] def buildModel(union: ApiBuilderType.Union, discriminator: String, fields: Seq[Field]): UnionModel = { - val enum = buildDiscriminatorEnum(union, discriminator) + val `enum` = buildDiscriminatorEnum(union, discriminator) val allFields = Seq(buildDiscriminatorField(union, enum, discriminator)) ++ fields UnionModel( service = union.service, diff --git a/src/main/scala/io/apibuilder/validation/AnyType.scala b/src/main/scala/io/apibuilder/validation/AnyType.scala index 2dd7630..f7594f3 100644 --- a/src/main/scala/io/apibuilder/validation/AnyType.scala +++ b/src/main/scala/io/apibuilder/validation/AnyType.scala @@ -60,7 +60,7 @@ case class ApiBuilderField(service: ApiBuilderService, field: Field) case class ApiBuilderUnionType(union: ApiBuilderType.Union, `type`: UnionType) object ApiBuilderType { - case class Enum(override val service: ApiBuilderService, enum: models.Enum) extends ApiBuilderType { + case class Enum(override val service: ApiBuilderService, `enum`: models.Enum) extends ApiBuilderType { override val name: String = enum.name override val typeDiscriminator: TypeDiscriminator = TypeDiscriminator.Enums } diff --git a/src/test/scala/io/apibuilder/util/UnionToModelBuilderSpec.scala b/src/test/scala/io/apibuilder/util/UnionToModelBuilderSpec.scala index cf8cc50..4da9d92 100644 --- a/src/test/scala/io/apibuilder/util/UnionToModelBuilderSpec.scala +++ b/src/test/scala/io/apibuilder/util/UnionToModelBuilderSpec.scala @@ -77,7 +77,7 @@ class UnionToModelBuilderSpec extends AnyWordSpec with Matchers "validates all types are models" must { "enum" in { - val enum = makeEnum("test") + val `enum` = makeEnum("test") setupInvalid(enums = Seq(enum)) must equal( Seq("Type 'test' is an enum. A model is required") ) diff --git a/src/test/scala/io/apibuilder/validation/ApiBuilderTypeSpec.scala b/src/test/scala/io/apibuilder/validation/ApiBuilderTypeSpec.scala index cf429d8..1248940 100644 --- a/src/test/scala/io/apibuilder/validation/ApiBuilderTypeSpec.scala +++ b/src/test/scala/io/apibuilder/validation/ApiBuilderTypeSpec.scala @@ -8,7 +8,7 @@ import org.scalatest.funspec.AnyFunSpec class ApiBuilderTypeSpec extends AnyFunSpec with Matchers with Helpers { private[this] lazy val service = loadService("flow-api-service.json") - private[this] lazy val enum = ApiBuilderType.Enum(service, Enum("gender", "genders", values = Nil)) + private[this] lazy val `enum` = ApiBuilderType.Enum(service, Enum("gender", "genders", values = Nil)) private[this] lazy val model = ApiBuilderType.Model(service, Model("user", "users", fields = Nil)) private[this] lazy val union = ApiBuilderType.Union(service, Union("test", "tests", types = Nil)) diff --git a/src/test/scala/io/apibuilder/validation/helpers/Helpers.scala b/src/test/scala/io/apibuilder/validation/helpers/Helpers.scala index 9121924..81cff36 100644 --- a/src/test/scala/io/apibuilder/validation/helpers/Helpers.scala +++ b/src/test/scala/io/apibuilder/validation/helpers/Helpers.scala @@ -51,7 +51,7 @@ trait Helpers { ) } - def rightOrErrors[_,V](f: Either[_, V]): V = { + def rightOrErrors[V](f: Either[_, V]): V = { f match { case Left(bad) => sys.error(s"Expected valid value but got: $bad") case Right(v) => v