You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Contains an enum with initial 4 values: CAT, DOG, DUCK and UNKNOWN.
Default value for the enum is UNKNOWN.
TypeV2
Contains a subset of the previous enum: DOG and UNKNOWN.
Default value for the enum is UNKNOWN.
I'm serializing an object of TypeV1 with value DUCK and I try to deserialize it with TypeV2. I expected the value to be UNKNOWN. Why wouldn't this work? It results in the error below:
./node_modules/avsc/lib/types.js:546
throw new Error(f('cannot read %s as %s', type, this));
^
Error: cannot read {"type":"enum","symbols":["CAT","DOG","DUCK","UNKNOWN"]} as {"type":"enum","symbols":["DOG","UNKNOWN"]}
at EnumType.Type.createResolver (./node_modules/avsc/lib/types.js:546:11)
at RecordType._update (./node_modules/avsc/lib/types.js:2366:30)
at RecordType.Type.createResolver (./node_modules/avsc/lib/types.js:542:10)
at main (./main.js:46:31)
at Object.<anonymous> (./main.js:52:5)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
I'm trying to make the following scenario work:
TypeV1
CAT
,DOG
,DUCK
andUNKNOWN
.UNKNOWN
.TypeV2
DOG
andUNKNOWN
.UNKNOWN
.I'm serializing an object of
TypeV1
with valueDUCK
and I try to deserialize it withTypeV2
. I expected the value to beUNKNOWN
. Why wouldn't this work? It results in the error below:The text was updated successfully, but these errors were encountered: