Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FhirXmlPocoDeserializer should throw an error when encountering multiple non-repeatable elements. #2435

Closed
mmsmits opened this issue Apr 17, 2023 · 1 comment
Assignees

Comments

@mmsmits
Copy link
Member

mmsmits commented Apr 17, 2023

FhirXmlPocoDeserializer doesn't catch invalid repeating elements.

Here's a unit test that proves this:

        [TestMethod]
        public void TryDeserializeMultipleNonRepeatingValues()
        {
            var content = "<name xmlns=\"http://hl7.org/fhir\" >" +
                                "<family value=\"oof\"/>" +
                                "<family value=\"bar\"/>" +
                          "</name>";

            var reader = constructReader(content);
            reader.Read();
            var state = new FhirXmlPocoDeserializerState();

            var deserializer = getTestDeserializer(new());
            var datatype = deserializer.DeserializeElementInternal(typeof(TestHumanName), reader, state);

            datatype.Should().BeOfType<TestHumanName>();
            datatype.As<TestHumanName>().Family.Should().Be("bar"); 

            state.Errors.Should().HaveCount(1);
        }

Todo:

  • Add a new error to FhirXmlException that describes the kind error
  • Throw this new error when encountering multiple non-repeating elements.
@ewoutkramer
Copy link
Member

This was fixed by #2434.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants