Altinn / app-lib-dotnet

Libraries used in Altinn Apps
BSD 3-Clause "New" or "Revised" License
8 stars 11 forks source link

"nil=true" in XML disapears for elements of type xs:date #911

Open oysteinthoensisjord opened 1 week ago

oysteinthoensisjord commented 1 week ago

Description of the bug

For schemas having elements of type xs:date and nillable = true, the XML which is stored in an instance loses the xsi:nil=true attribute at some point.

Related to xs:date, it is represented in C# as a string having a regex. Couldn't it be represented as DateOnly instead?

Steps To Reproduce

Define element in XSD: <xs:element name="tillatelsedato" type="xs:date" nillable="true" minOccurs="0" maxOccurs="1"/>

Create instance with nil input for the datefield XML input <tillatelsedato xsi:nil="true" />

Retreive the dataelement, the ouput will be like this <tillatelsedato/>

Additional Information

oysteinthoensisjord commented 4 days ago

Nice! I've by deleting and adding the datamodel in our app once more. Now it seems to behave as expected.

A note: deleting the datamodel in Altinn Studio isn't trivial. The popup for confirming the deletion is hidden by the top menu. BUT! Opening developer tools and making the window quite small reveals the popup. Image