Skip to content
This repository has been archived by the owner on Oct 17, 2019. It is now read-only.

Prevent crashes on extensions that don't have target profiles #44

Merged
merged 4 commits into from
May 1, 2019

Conversation

dehall
Copy link
Contributor

@dehall dehall commented Apr 22, 2019

Something changed upstream recently and the es6 exporter is now being passed slightly different element definitions for the slice root and fields on Extension.extension. This is causing the exporter to crash as it expects every element definition under an Extension to have a target profile, but the slice root isn't going to have a target profile. (see master where the tests are currently failing despite no changes to the test fixture spec here)
This change just checks for whether the field structure is present before trying to read it, so it doesn't crash if the expected field isn't there.

I do think more testing would be good to ensure that extensions are truly handled correctly in all cases, but at minimum this will ensure the generator continues to function as it did previously, and more importantly doesn't crash. The test on PatientEntry.fromFHIR includes a complex extension which is still handled correctly.

Note: this also disables the BloodPressureSliceByNumber test which is suddenly failing. Based on some limited investigation the issue also seems to be upstream since the profile the generator receives here doesn't contain fixed values for the field named as the discriminator.

@dehall dehall changed the title WIP: Prevent crashes on extensions that don't have target profiles Prevent crashes on extensions that don't have target profiles Apr 25, 2019
@dehall dehall requested a review from cmoesel April 25, 2019 12:40
@cmoesel
Copy link
Member

cmoesel commented May 1, 2019

Code looks good, tests pass, and it doesn't crash running against the SHR spec. There are tons of errors, but I think that's expected (and the purpose of this PR is to prevent the crash).

I'll bump the version number, push to the branch, and then merge. Thanks, @dehall!

@cmoesel cmoesel merged commit 5d15e55 into master May 1, 2019
@cmoesel cmoesel deleted the extension_error_fix branch May 1, 2019 18:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants