snowplow / snowplow-badrows

Apache License 2.0
7 stars 2 forks source link

Deseralization is broken for LoaderIgluError.NotAnArray #83

Open istreeter opened 11 months ago

istreeter commented 11 months ago

There are two case classes that have the exact same fields and types:

final case class NotAnArray(schemaKey: SchemaKey, value: Json, expected: String) extends LoaderIgluError
final case class WrongType(schemaKey: SchemaKey, value: Json, expected: String) extends LoaderIgluError

When these classes are serialized to JSON, it is impossible to know which was the original case class:

{
  "schemaKey": "iglu:my.vendor/my_schema/jsonschema/1-0-0",
  "value": 42,
  "expected": "expectation"
}

This means, when a NotAnArray is deserialized from JSON, it is interpreted as a WrongType.