allegro / json-avro-converter

JSON to Avro conversion tool designed to make migration to Avro easier.
Other
277 stars 97 forks source link

Problem decoding union of map: Failed to convert JSON to Avro #59

Open nicodv opened 3 years ago

nicodv commented 3 years ago

Example schema:

protocol ScoreData {
  record ScoreData {
    string id;
    union {null, map<double>} multiScore = null;
  }
}

Example payload:

"{\"id\":\"myKey\",\"multiScore\":{\"map\":{\"a\":10.0}}}"

Exception:

tech.allegro.schema.json2avro.converter.AvroConversionException: Failed to convert JSON to Avro: Could not evaluate union, field multiScore is expected to be one of these: NULL, MAP. If this is a complex type, check if offending field: multiScore adheres to schema.

AFAICT, this is syntactically valid JSON for a union{null, map}. I've tried with avro4s too and it decodes things without issues.

Version: 0.2.10

andzelika-domanska commented 2 years ago

Hi @nicodv :) I'll take a closer look at this issue.

etsybaev commented 1 year ago

Hi there.

Are there any updates? It seems like we have a branch of onCall issues caused by this one. For example https://github.com/airbytehq/oncall/issues/1047, https://github.com/airbytehq/oncall/issues/1089, and so on. Thanks!