Stream: dotnet
Topic: Getting ElementDefinition for Poco
Patrick Lehti (Nov 16 2021 at 07:51):
Hi!
I am trying to get the matching ElementDefinition for each element of a resource (POCO). I wonder if there is an existing way for that in the firely SDK? I had a look on ITypedElement, which gives me these ElementDefinitionSummaries, which lack some of the information I need. Is there any other existing way to do this?
Regards,
Patrick
Ewout Kramer (Nov 16 2021 at 08:22):
Hi Patrick, no - the generated POCOs do not have the full ElementDefinitions represented as reflection attributes - only the ones necessary for (de)serialization and basic validation. You would have to navigate through the original StructureDefinitions to do so. There are many functions for doing so - the ElementDefinitionNavigator
will help you represent the flat structure of the ElementDefinitions in StructureDefinition as a tree. Additionally there are resolvers to help you find a StructureDefinition given a canonical, e.g. the ZipSource
(which scans the specification.zip in the Nuget package) and the DirectorySource
(which searches through a directory on disk).
Patrick Lehti (Nov 16 2021 at 08:42):
Hi Ewout, thanks for the prompt answer! I will have a look at the ElementDefinitionNavigator. The resolvers I already know from validation...
Last updated: Apr 12 2022 at 19:14 UTC