Assign date or dateTime that contains only year #1511
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
A FHIR date or dateTime may be 4-digit year. The FSH parser will assign this value a NUMBER token type. When assigning to a date or dateTime element, if a type mismatch occurs, and the original value is a number, try to assign the raw value. If it is a valid 4-digit year, it will be assigned successfully. Otherwise, the original error will be thrown and logged.
I don't really like my implementation here: it's very similar code in all four exporters. I didn't manage to come up with a good way to isolate the "retry with another value" code, but I think it would be better if it looked like that.
Testing Instructions:
Tests are added to exporter classes to demonstrate assignment of these values.
Related Issue:
Fixes #1483