FHIR Chat · FhirParser · dotnet

Stream: dotnet

Topic: FhirParser


view this post on Zulip Bryn Rhodes (Oct 10 2018 at 05:23):

I'm upgrading some code that uses the now deprecated FhirParser.Parse method and I'm not finding a way to do what I need, namely, parse a resource without knowing what type it is.

view this post on Zulip Bryn Rhodes (Oct 10 2018 at 05:25):

The new Parse methods all require a type, and if I pass null, I get the expected "key is null" exception. I'm sure I'm just missing something simple, but I don't see a way to do it. I've searched through the topics here, and the only mention is the post that says don't use FhirParser.Parse anymore :(

view this post on Zulip Bryn Rhodes (Oct 10 2018 at 05:35):

Figured it out, I need to pass typeof(Resource). It's a little surprising, because the fact that it's a required argument makes me think that I need to pass the correct type.

view this post on Zulip Michel Rutten (Oct 10 2018 at 13:41):

Hi @Bryn Rhodes, the FHIR API uses this same pattern in a couple of different places, i.e. a generic type parameter that also accept the Resource base class. Do you have any suggestions on how we could clarify and/or improve discoverability for new consumers?

view this post on Zulip Bryn Rhodes (Oct 10 2018 at 14:47):

Hi @Michel Rutten, thanks for following up! I would suggest providing an overload that doesn't have a type parameter, that would have been clearer, at least to me.

view this post on Zulip Michel Rutten (Oct 10 2018 at 14:58):

Great, I was thinking along those same lines. Could you submit a feature request to Github?
https://github.com/ewoutkramer/fhir-net-api/issues
Specifically for Parse method, but it makes sense to harmonize this approach over all existing similar generic methods.

view this post on Zulip Michel Rutten (Oct 10 2018 at 16:27):

https://github.com/ewoutkramer/fhir-net-api/issues/726
Great, thanks Bryn!

view this post on Zulip Brian Postlethwaite (Oct 10 2018 at 20:31):

There used to be a method called ParseResource that did this.

view this post on Zulip Brian Postlethwaite (Oct 10 2018 at 20:32):

As the type less version only works for resources, nothing else.


Last updated: Apr 12 2022 at 19:14 UTC