Compile Error - Incompatible types by name with Identical Read and Write schema.
Closed this issue · 2 comments
gogen-arvo 7.10
Getting this error "Incompatible types by name" when compiling a schema (for deserialize) which contains some unions with a mix of arrays and nullable arrays.
2020/07/10 13:15:42 Incompatible types by name: &{Energistics.Etp.v12.Datatypes.ArrayOfBoolean 0xc000146230} &{Energistics.Etp.v12.Datatypes.ArrayOfNullableBoolean 0xc000146a10}
The two types 'ArrayOfBoolean' and ArrayofNullableBoolean differ as follows.
{
"type": "record",
"namespace": "Energistics.Etp.v12.Datatypes",
"name": "ArrayOfBoolean",
"fields":
[
{
"name": "values",
"type": { "type": "array", "items": "boolean" }
}
]
}
{
"type": "record",
"namespace": "Energistics.Etp.v12.Datatypes",
"name": "ArrayOfNullableBoolean",
"fields":
[
{
"name": "values",
"type": { "type": "array", "items": ["null", "boolean"] }
}
]
}
And the base Type is.
{
"type": "record",
"namespace": "Energistics.Etp.v12.Datatypes",
"name": "DataValue",
"fields":
[
{"name": "item",
"type": [
"null",
"boolean",
"int",
"long",
"float",
"double",
"string",
"Energistics.Etp.v12.Datatypes.ArrayOfBoolean",
"Energistics.Etp.v12.Datatypes.ArrayOfNullableBoolean",
"Energistics.Etp.v12.Datatypes.ArrayOfInt",
"Energistics.Etp.v12.Datatypes.ArrayOfNullableInt",
"Energistics.Etp.v12.Datatypes.ArrayOfLong",
"Energistics.Etp.v12.Datatypes.ArrayOfNullableLong",
"Energistics.Etp.v12.Datatypes.ArrayOfFloat",
"Energistics.Etp.v12.Datatypes.ArrayOfDouble",
"Energistics.Etp.v12.Datatypes.ArrayOfString",
"bytes",
"Energistics.Etp.v12.Datatypes.AnySparseArray"
]
}
]
}
This error occurs for ALL THREE of the type which have a Nullable, and a normal (non nullable) version.
It is important when desalinizing the message that can understand which one of the entries in the union was used.
- The Read and Write Schemas are IDENTICAL.
- It serializes fine, (or appears to), just seems to be throwing an error on compiling for deserialize.
Compile Output attached.
CompileError.txt
Note: I've read the other issues raise which are about the same error, and this one seems different (at least to my eye).
The names of these two types ARE different, and i'm not sure why the compiler is trying to equate them, then throwing an error.
Thoughts ?
Can you try v7.1.1 and let me know if it still has this issue? 7.1.0 doesn't include a fix for resolving union types by exact name matches which I think would fix this.
v7.1.1 appears to fix the issue. My tests now pass again. Thanks !.