Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem decoding union of INT or STRING : Failed to validate JSON to Avro #73

Open
alibenmessaoud opened this issue Mar 2, 2022 · 0 comments

Comments

@alibenmessaoud
Copy link

alibenmessaoud commented Mar 2, 2022

I have a problem to validate JSON from Kafka:

We receive data as an example as follows:

"slotid": {
  "string": "xyz"
}

The validation shows this error:

org.opentest4j.AssertionFailedError: Unexpected exception thrown: tech.allegro.schema.json2avro.converter.AvroConversionException: Failed to convert JSON to Avro: Could not evaluate union, field slotid is expected to be one of these: NULL, STRING. If this is a complex type, check if offending field: slot.slotid adheres to schema.

But it works for an input as follows :

"slotid": "xyz" 

In the schema, we have:

"name" : "slotid",
"type" : [ "null", "string" ],
"default" : null

The same thing for other types like INT, MAP, etc.:

"source": {
  "map": {
    "originCreationTime": "xxx",
    "originId": "yyy"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant