-
Notifications
You must be signed in to change notification settings - Fork 345
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
Change ClassMappings so it can support custom resources #2850
Comments
It is definitely worth looking at JsonTypeInfo for inspiration, including its inheritance hierarchy of metadata inspectors and modifiers. |
I have done a spike and the main problems that we have to find a design for are:
Other than this there are some minor issues with dependence on native types in the parser and |
Also, I have tried to remove |
As part of our effort to support "custom resources" through Pocos (and more specifically through the new DynamicResource/DynamicDataType), we will need a way to provide metadata about these resources so they can be parsed and serialized. Custom resources are useful in general for supporting data that does not have an equivalent in FHIR (yet), but also to add new elements for newer, in-preview versions of FHIR (or even IGs), without having to generate a full new version of the SDK for it.
Currently, the ClassMappings are constructed by reflecting on the POCO's, but by definition DynamicResources will not have any static reflectable type information, so the information should be supplied by the user. In fact, we have an existing mechanism for that,
IStructureDefinitionSummary
which was designed to support theITypedElement
subsystem. The current ClassMappings implementIStructureDefinitionSummary
, so there is already a strong link between the two abstractions. Whatever we do, the new capabilities shoul;d still supportIStructureDefinitionSummary
, so the ITypedElement stack can be retained.I have done a quick survey over the metadata that the serializers & parsers need, and it looks to me that none of it is inherently tied to reflection, even the generated getters/setters could be rewritten to use IDictionary (if we so choose), and thus be re-useable across resources and dynamic resources.
Note that the POCO's should be prepared for this change to use something akin
IDictionary
(not onlyIReadonlyDictionary
) so the (de)serializers can treat poco's and dynamic resources uniformly and so they can deal with overflow elements. This is a separate task (TODO: add a link to that separate task once created).The text was updated successfully, but these errors were encountered: