From ac2c1fdcad2915070d148a5e115212ddce56d10f Mon Sep 17 00:00:00 2001 From: tiboun Date: Thu, 19 Dec 2024 21:26:30 +0100 Subject: [PATCH] fix scala 2.12 compilation --- .../extract/impl/openapi/OpenAPISchemaExtractor.scala | 5 ++--- .../ai/starlake/extract/utils/LoadConfigMelderSpec.scala | 2 +- .../ai/starlake/schema/generator/YamlSerdeSpec.scala | 8 +++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/scala/ai/starlake/extract/impl/openapi/OpenAPISchemaExtractor.scala b/src/main/scala/ai/starlake/extract/impl/openapi/OpenAPISchemaExtractor.scala index 27f2b2b07..247965d37 100644 --- a/src/main/scala/ai/starlake/extract/impl/openapi/OpenAPISchemaExtractor.scala +++ b/src/main/scala/ai/starlake/extract/impl/openapi/OpenAPISchemaExtractor.scala @@ -33,7 +33,6 @@ import io.swagger.v3.parser.OpenAPIV3Parser import io.swagger.v3.parser.core.models.ParseOptions import java.util.regex.Pattern -import scala.collection.View import scala.jdk.CollectionConverters._ import scala.util.Try @@ -484,7 +483,7 @@ class OpenAPISchemaExtractor( currentSchema: OpenAPISwaggerSchema[_], currentPath: Option[String] = None ): OpenAPISwaggerSchema[_] = { - def handleObjectSchema(os: OpenAPISwaggerSchema[_]) = { + def handleObjectSchema(os: OpenAPISwaggerSchema[_]): OpenAPISwaggerSchema[_] = { val newProperties = os.getProperties.asScala .filter { case (name, _) => !fieldPatterns.exists( @@ -494,7 +493,7 @@ class OpenAPISchemaExtractor( .map { case (name, pSchema) => name -> processExclusion(pSchema, currentPath.map(_ + "_" + name)) } - .toMap + .toMap[String, OpenAPISwaggerSchema[_]] .asJava os.setProperties(newProperties) os diff --git a/src/test/scala/ai/starlake/extract/utils/LoadConfigMelderSpec.scala b/src/test/scala/ai/starlake/extract/utils/LoadConfigMelderSpec.scala index 615653ea6..3cb9429cb 100644 --- a/src/test/scala/ai/starlake/extract/utils/LoadConfigMelderSpec.scala +++ b/src/test/scala/ai/starlake/extract/utils/LoadConfigMelderSpec.scala @@ -11,7 +11,7 @@ import ai.starlake.core.utils.{ TableAttributeMelderConfig, TableMelderConfig } -import ai.starlake.schema.model.{Attribute, Domain, Metadata, Schema, TransformInput} +import ai.starlake.schema.model.{Attribute, Domain, Metadata, Schema} import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers diff --git a/src/test/scala/ai/starlake/schema/generator/YamlSerdeSpec.scala b/src/test/scala/ai/starlake/schema/generator/YamlSerdeSpec.scala index 27b23d3c1..c3a8b4221 100644 --- a/src/test/scala/ai/starlake/schema/generator/YamlSerdeSpec.scala +++ b/src/test/scala/ai/starlake/schema/generator/YamlSerdeSpec.scala @@ -24,7 +24,6 @@ import ai.starlake.config.Settings.{ import ai.starlake.config.{ApplicationDesc, Settings} import ai.starlake.extract._ import ai.starlake.extract.impl.openapi.{ - All, Get, HttpOperation, OpenAPIDomain, @@ -32,8 +31,7 @@ import ai.starlake.extract.impl.openapi.{ OpenAPIRoute, OpenAPIRouteExplosion, OpenAPISchema, - Post, - RouteExplosionStrategy + Post } import ai.starlake.job.load.{IngestionNameStrategy, IngestionTimeStrategy} import ai.starlake.schema.model._ @@ -52,7 +50,7 @@ import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks import java.util.TimeZone import java.util.regex.Pattern import scala.jdk.CollectionConverters._ -import scala.util.{Failure, Success, Try} +import scala.util.{Failure, Success} class YamlSerdeSpec extends TestHelper with ScalaCheckPropertyChecks with TryValues { new WithSettings() { @@ -659,7 +657,7 @@ object YamlConfigGenerators { implicit val openAPIExtractSchema: Arbitrary[OpenAPIExtractSchema] = Arbitrary { for { basePath <- arbitrary[Option[String]] - formatTypeMapping <- arbitrary[Map[String, Pattern]].map(_.view.mapValues(_.toString).toMap) + formatTypeMapping <- arbitrary[Map[String, Pattern]].map(_.mapValues(_.toString).toMap) domains <- arbitrary[List[OpenAPIDomain]].filter(_.nonEmpty) } yield OpenAPIExtractSchema( basePath = basePath,