|
UnionTypeCodec.deserialize() invokes the default char[] constructor, which requires adaptation to/from String. As evidenced in BUG-6006, this is not enough and the solution to that issue is a bit hacky.
YANG defines the order in which the members should be tried, hence UnionCodec should decode the appropriate member class and invoke the proper constructor for the member – we already have UnionValueOptionContext, which can hold this information.
This has a slight problem in potentially mis-matching types (in case of union of string and binary), hence binding codecs should expose a value-based check if the invocation should even be tried.
|