[YANGTOOLS-1108] Leaf of type union containing identity-ref is not correctly transformed to XML Created: 03/Jun/20  Updated: 04/Jun/20  Resolved: 04/Jun/20

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: 3.0.12, 5.0.3, 4.0.10

Type: Bug Priority: Medium
Reporter: Anna Bencúrová Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Issue split
split to YANGTOOLS-1109 Use XmlCodecs for value writeout Confirmed
Relates
relates to YANGTOOLS-1110 Issue a warning when an identityref i... Resolved

 Description   

If some leaf has type union, which is containing also identity-ref, NormalizedNode with filled this leaf with some identity is not correctly rendered to XML.

E.g.:

 

module foo {
  namespace "foo-namespace";
  prefix "f";
  identity ident-base;
  identity ident-one {
    base ident-base;
  }

  ...
  leaf union-identityref-leaf {
    type union-type;
  }

  leaf identityref-leaf {
    type identityref {
      base ident-base;
    }

  }

  ...
}

 

 

If both leaves will have set as value identity ident-one, the XML converted output will be following:

<identityref-leaf>ident-one</identityref-leaf>
<union-identityref-leaf>(foo-namespace)ident-one</union-identityref-leaf>

The leaf identityref-leaf is converted correctly, but union-identityref-leaf with union has string QName included, which will not be converted using opposite direction.



 Comments   
Comment by Robert Varga [ 04/Jun/20 ]

Yeah, this is caused by XML writeout path going in the completely wrong legacy direction with codecs.

Generated at Wed Feb 07 20:55:12 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.