Skip to content

Commit

Permalink
Bump iglu-scala-client to 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
spenes committed Sep 20, 2024
1 parent 875ebbd commit 1dbbb18
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ package com.snowplowanalytics.snowplow.rdbloader.common
import cats.{Monad, Order}
import cats.data.EitherT
import cats.effect.Clock
import cats.syntax.all._
import com.snowplowanalytics.iglu.client.resolver.registries.RegistryLookup
import com.snowplowanalytics.iglu.client.{ClientError, Resolver}
import com.snowplowanalytics.iglu.core.{SchemaCriterion, SchemaKey}
import com.snowplowanalytics.iglu.client.Resolver.SchemaResolutionError
import com.snowplowanalytics.iglu.core.SchemaKey
import com.snowplowanalytics.iglu.schemaddl.jsonschema.Schema
import com.snowplowanalytics.iglu.schemaddl.jsonschema.circe.implicits.toSchema
import com.snowplowanalytics.snowplow.badrows.FailureDetails.LoaderIgluError
Expand Down Expand Up @@ -44,26 +44,15 @@ object SchemaProvider {
resolver: Resolver[F],
schemaKey: SchemaKey
): EitherT[F, LoaderIgluError, List[SchemaWithKey]] =
EitherT(resolver.listSchemasLike(schemaKey))
.leftMap(resolverFetchBadRow(schemaKey.vendor, schemaKey.name, schemaKey.format, schemaKey.version.model))
.map(_.schemas)
.flatMap(schemaKeys =>
schemaKeys
.traverse(schemaKey =>
getSchema(resolver, schemaKey)
.map(schema => SchemaWithKey(schemaKey, schema))
)
)

private def resolverFetchBadRow(
vendor: String,
name: String,
format: String,
model: Int
)(
e: ClientError.ResolutionError
): LoaderIgluError =
LoaderIgluError.SchemaListNotFound(SchemaCriterion(vendor = vendor, name = name, format = format, model = model), e)
for {
jsons <- EitherT(resolver.lookupSchemasUntil(schemaKey))
.leftMap { case SchemaResolutionError(schemaKey, error) => resolverBadRow(schemaKey)(error) }
schemas <- jsons.traverse { json =>
EitherT
.fromOption[F](Schema.parse(json.schema), parseSchemaBadRow(json.self.schemaKey))
.map(schema => SchemaWithKey(json.self.schemaKey, schema))
}
} yield schemas.toList

private def resolverBadRow(schemaKey: SchemaKey)(e: ClientError.ResolutionError): LoaderIgluError =
LoaderIgluError.IgluError(schemaKey, e)
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object Dependencies {
object V {
// Scala (Loader)
val decline = "2.4.1"
val igluClient = "3.1.1"
val igluClient = "3.2.0"
val igluCore = "1.1.1"
val badrows = "2.2.0"
val analyticsSdk = "3.1.0"
Expand Down

0 comments on commit 1dbbb18

Please sign in to comment.