Stream: dotnet
Topic: Serializing empty element
Michele Mottini (Mar 25 2019 at 15:47):
So if you have empty strings somewhere - eg empty Identifier.Value - new Patient{Identifier = new List<Identifier>{new Identifier("https://mydomain.com/myid", "")}}
the serialization generates that element with an empty value, that is invalid and that cause de-serialization to fail
Michele Mottini (Mar 25 2019 at 15:47):
This seems a bug - or are there reason for that behavior?
Michele Mottini (Mar 25 2019 at 17:45):
https://github.com/FirelyTeam/fhir-net-api/pull/915
Ewout Kramer (Apr 01 2019 at 12:28):
Hi @Michele Mottini - the FhirXmlSerializer has a code path to not serialize attributes when they are empty, so this is a bug ;-) Thanks for the PR.
Michele Mottini (Apr 01 2019 at 21:20):
OK - so there is a better fix than the one in my PR - ie fixing the original code path?
Ewout Kramer (Apr 02 2019 at 07:49):
OK - so there is a better fix than the one in my PR - ie fixing the original code path?
I think so - I need to dig down to see where this goes wrong. Your fix works for when you use POCO's, but if you use poco-less parsing (http://docs.simplifier.net/fhirnetapi/parsing/intro-to-elementmodel.html) this should not happen either. So I will try to find out exactly where this happens.
Michele Mottini (Apr 02 2019 at 08:27):
Got it - let me know when you find it, so I can apply the 'right' fix to our fork
Last updated: Apr 12 2022 at 19:14 UTC