LordVeovis / xmlrpc

A port of CookComputing.XmlRpcV2 for dotnet core 2
MIT License
33 stars 21 forks source link

Handle deserialisation of <nil/> data type #13

Closed steveglen closed 5 years ago

LordVeovis commented 5 years ago

Hi,

I've just written a test but I'm afraid it's a bit too synthetic.

steveglen commented 5 years ago

My use case is NIPAP, most of its calls return in their XML for null values. For example this call: https://nipap.readthedocs.io/en/v0.29.6/nipap.html#nipap.backend.Nipap.list_vrf

Response XML looks like this:

<array><data>
        <value><struct>
                <member>
                    <name>rt</name>
                    <value><nil /></value></member>
                <member>
                    <name>total_addresses_v6</name>
                    <value><string>871509787656907713528983453696</string></value>
                </member>
                <member>
                    <name>total_addresses_v4</name>
                    <value><string>53276944</string></value>
                </member>
                <member>
                    <name>description</name>
                    <value><string>The default VRF, typically the Internet.</string></value>
                </member>
                <member>
                    <name>free_addresses_v6</name>
                    <value><string>866220736661138132752066936832</string></value>
                </member>
                <member>
                    <name>used_addresses_v6</name>
                    <value><string>5289050995769580776916516864</string></value>
                </member>
                <member>
                    <name>used_addresses_v4</name>
                    <value><string>13234488</string></value>
                </member>
                <member>
                    <name>tags</name>
                    <value><array><data>
                            </data></array></value>
                </member>
                <member>
                    <name>name</name>
                    <value><string>default</string></value>
                </member>
                <member>
                    <name>num_prefixes_v6</name>
                    <value><string>11679</string></value>
                </member>
                <member>
                    <name>avps</name>
                    <value><struct>
                        </struct></value>
                </member>
                <member>
                    <name>num_prefixes_v4</name>
                    <value><string>36705</string></value>
                </member>
                <member>
                    <name>id</name>
                    <value><int>0</int></value>
                </member>
                <member>
                    <name>free_addresses_v4</name>
                    <value><string>40042456</string></value>
                </member>
            </struct></value>
    </data></array>

Please let me know if you need more info to reproduce

steveglen commented 5 years ago

Also it looks like another of the pull requests you have deals with the serialisation?

I came from the latest version of CookComputing.XmlRpc (not the stable version) over to this codebase, in order to work with .net core, but this was a notable regression for me (it worked with the CookComputing codebase).

LordVeovis commented 5 years ago

Also it looks like another of the pull requests you have deals with the serialisation?

I came from the latest version of CookComputing.XmlRpc (not the stable version) over to this codebase, in order to work with .net core, but this was a notable regression for me (it worked with the CookComputing codebase).

yeah, I'm sorry to read that. I really thought the stability was better than picking up on the beta version when I did convert the Cook's library into .netcore. Yes #11 is about serialization, which is good as complementary to this one. I think #13 should be ready this week with a simple unit test.

I'm also making use of this PR to configure circle ci on this project to auto-run the existing tests.