-
Notifications
You must be signed in to change notification settings - Fork 164
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
Fix compile errors with Hl7.Fhir.R4 version 4.x #502
Fix compile errors with Hl7.Fhir.R4 version 4.x #502
Conversation
As newer firely implements IEnumerable<X> in more classes, we check that X = Element before actually doing traversal. Without this test, an illegal cast exception is generated.
Newer Firely library has where T: struct, Enum.
Thanks, I'll have a look at this later! |
// If this member is an IEnumerable<Element>, go inside and recurse | ||
if (property.PropertyType.GetInterface("IEnumerable`1") != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange that this doesn't work already, it seems we should already be filtering properly in propertyFilter()
. Can you instead of doing another filtering on IEnumerable<Element>
see how we can improve propertyFilter()
?
On 17.08.2022 20:22, Kenneth Myhra wrote:
***@***.**** commented on this pull request.
------------------------------------------------------------------------
In src/Spark.Engine/Auxiliary/ResourceVisitor.cs
<#502 (comment)>:
> // If this member is an IEnumerable<Element>, go inside and recurse
- if (property.PropertyType.GetInterface("IEnumerable`1") != null)
Strange that this doesn't work already, it seems we should already be
filtering properly in |propertyFilter()|. Can you instead of doing
another filtering on |IEnumerable<Element>| see how we can improve
|propertyFilter|()?
The "problem" stems from
FirelyTeam/firely-net-common@81f58a7
this adds IReadOnlyDictionary<KeyValuePair<string, object>>, which again
inherits from IEnumerable<KVP<s, o>>. So the code fails because the
propertyFilter also returns Element properties, and they are handled later.
Agree, the code could probably be cleaner factoring out the predicates
from the two functions.
… Message ID: ***@***.***>
|
Share predicate to discriminate between single element properties and enumerable of elements. Same function call => clearer intentions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is a nice improvement!
Have done some minimal testing with Hl7.Fhir.R4 version 4.1.0, but have hit some snags that seems to be fixed with a couple of small changes, that I believe should not have any implications on the functionality. But I am not very familiar with code base.