<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:54:54 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>OpenDaylight JIRA</title>
    <link>https://jira.opendaylight.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>8.20.10</version>
        <build-number>820010</build-number>
        <build-date>22-06-2022</build-date>
    </build-info>


<item>
            <title>[YANGTOOLS-1003] Anyxml list data are wrapped in &quot;array-element&quot;</title>
                <link>https://jira.opendaylight.org/browse/YANGTOOLS-1003</link>
                <project id="10188" key="YANGTOOLS">yangtools</project>
                    <description>&lt;p&gt;Given rpc definition:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
rpc some-action {
&#160; input {
&#160;&#160;&#160; anyxml data;
&#160; }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;And data passed into restconf:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
{
  &lt;span class=&quot;code-quote&quot;&gt;&quot;input&quot;&lt;/span&gt; : {
&#160;&#160;&#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;data&quot;&lt;/span&gt; : [
&#160; &#160;&#160;&#160; { &lt;span class=&quot;code-quote&quot;&gt;&quot;key&quot;&lt;/span&gt; : &lt;span class=&quot;code-quote&quot;&gt;&quot;value&quot;&lt;/span&gt; }
&#160;&#160;&#160; ]
&#160; }
}
&#160;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;results in following json element received from gson codec: &lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&lt;span class=&quot;code-quote&quot;&gt;&quot;data&quot;&lt;/span&gt; : {
&#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;array-element&quot;&lt;/span&gt; : { &lt;span class=&quot;code-quote&quot;&gt;&quot;key&quot;&lt;/span&gt; : &lt;span class=&quot;code-quote&quot;&gt;&quot; value&quot;&lt;/span&gt; }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;This breaks how jsonrpc digests anyxml data from restconf.&lt;/p&gt;

&lt;p&gt;I can&apos;t find reference to this behavior in RFC7951, so I think this is a bug.&lt;/p&gt;</description>
                <environment></environment>
        <key id="31740">YANGTOOLS-1003</key>
            <summary>Anyxml list data are wrapped in &quot;array-element&quot;</summary>
                <type id="10104" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.opendaylight.org/images/icons/priorities/major.svg">Medium</priority>
                        <status id="10003" iconUrl="https://jira.opendaylight.org/images/icons/status_generic.gif" description="">Confirmed</status>
                    <statusCategory id="2" key="new" colorName="blue-gray"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="rkosegi">Richard Kosegi</reporter>
                        <labels>
                    </labels>
                <created>Mon, 10 Jun 2019 20:15:23 +0000</created>
                <updated>Wed, 24 Jun 2020 11:34:20 +0000</updated>
                                            <version>2.0.12</version>
                    <version>2.1.10</version>
                    <version>3.0.2</version>
                    <version>4.0.8</version>
                                                    <component>codecs</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="66900" author="rovarga" created="Thu, 13 Jun 2019 09:03:08 +0000"  >&lt;p&gt;This has been the behaviour from day one. The reason for &apos;array-element&apos; is that XML encoding loses list encapsulation so if you read JSON anyxml and write the thing out you&apos;d lose the brackets in data. JSON codec uses this information to accurately emit the brackets. If you use JSON codec to send out the result, you will get a correct JSON &#8211; not perfect, but it works.&lt;/p&gt;

&lt;p&gt;Now to fix this without regressing, JSON codec needs to do something similar as DOMSourceAnydata is doing, but as a subclass of DOMSource containing an unencapsulated tree (passed to DOMSource constructor) and an encapulated tree (kept as an additional field). JSON egress needs to recognize this subclass and pick the escaped tree when writing out JSON.&lt;/p&gt;</comment>
                            <comment id="66904" author="rkosegi" created="Sun, 16 Jun 2019 16:14:39 +0000"  >&lt;p&gt;Thanks &lt;a href=&quot;https://jira.opendaylight.org/secure/ViewProfile.jspa?name=rovarga&quot; class=&quot;user-hover&quot; rel=&quot;rovarga&quot;&gt;rovarga&lt;/a&gt; for info. Can you elaborate a bit on &quot;If you use JSON codec to send out the result&quot;?&lt;/p&gt;

&lt;p&gt;Problem is actually in both ways.&lt;/p&gt;

&lt;p&gt;1, when user use restconf to invoke RPC with anyxml in input, following code is called &lt;a href=&quot;https://github.com/opendaylight/jsonrpc/blob/master/impl/src/main/java/org/opendaylight/jsonrpc/impl/JsonConverter.java#L219&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/opendaylight/jsonrpc/blob/master/impl/src/main/java/org/opendaylight/jsonrpc/impl/JsonConverter.java#L219&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before we send anything out, I can modify data and apply fix.&lt;/p&gt;

&lt;p&gt;2, But when response is received from external entity, following code is called &lt;a href=&quot;https://github.com/opendaylight/jsonrpc/blob/master/impl/src/main/java/org/opendaylight/jsonrpc/impl/JsonRPCtoRPCBridge.java#L303&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/opendaylight/jsonrpc/blob/master/impl/src/main/java/org/opendaylight/jsonrpc/impl/JsonRPCtoRPCBridge.java#L303 &lt;/a&gt;to form NormalizedNode.&lt;/p&gt;

&lt;p&gt;There is no way I&apos;m aware of I can do anything here, RPC output will be wrapped in array-element (if RPC output has anyxml node and data contains list)&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="67281" author="rovarga" created="Tue, 8 Oct 2019 15:00:30 +0000"  >&lt;p&gt;The constant comes from &lt;a href=&quot;https://github.com/opendaylight/yangtools/blob/master/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonParserStream.java#L66&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/opendaylight/yangtools/blob/master/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonParserStream.java#L66&lt;/a&gt; and is supposed to be eliminated when the DOMSource is streamed out again, i.e. in the JSON -&amp;gt; DOMSource -&amp;gt; JSON case. Not sure that works.&lt;/p&gt;

&lt;p&gt;The reason is that if the anyxml element represents a list, it needs to be captured as such &#8211; and hence it needs a containment node, which is &lt;b&gt;not&lt;/b&gt; part of DOMSource specification &#8211; i.e. it would &lt;b&gt;not&lt;/b&gt; be present were the anyxml node parsed from XML.&lt;/p&gt;

&lt;p&gt;As noted, this will need JSON-level event buffering, where the DOMSource view of anyxml will be not contain this hack use proper format. See &lt;a href=&quot;https://jira.opendaylight.org/browse/YANGTOOLS-994&quot; title=&quot;Add support for JSON-encoded anydata&quot; class=&quot;issue-link&quot; data-issue-key=&quot;YANGTOOLS-994&quot;&gt;YANGTOOLS-994&lt;/a&gt; for details.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="31700">YANGTOOLS-994</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_11400" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i03o5z:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>