allegro / allegro/json-avro-converter
Problem decoding union of INT or STRING : Failed to validate JSON to Avro
- Vorherrschende Sprache
- Groovy
- Sterne
- 286
- Forks
- 98
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I have a problem to validate JSON from Kafka:
We receive data as an example as follows:
```json
"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 :
```json
"slotid": "xyz"
```
In the schema, we have:
```json
"name" : "slotid",
"type" : [ "null", "string" ],
"default" : null
```
The same thing for other types like INT, MAP, etc.:
```json
"source": {
"map": {
"originCreationTime": "xxx",
"originId": "yyy"
}
}
```
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.