firely-net-sdk
firely-net-sdk copied to clipboard
Put core features of ITypedElement and ScopedNode in separate interfaces
Problem
Although the validator and FhirPath engine are built on top of ITypedElement
, they both don't need all methods and properties in that interface. On the other hand, both engines sometimes require more than is available in ITypedElement
, which are (some of) the features provided by ScopedNode
. These requirements are not expressed structurally in the method signatures of, say, Validate()
, instead the engines sniff their implementation of ITypedElement
to see whether the underlying implemenation is a ScopedNode. This leaves room for error (it is unclear to the caller he actually needed to supply a ScopedNode) and it ties the validator and FhirPath to a concrete implementation. This makes it impossible to easily use IReadOnlyDictionary.
Proposed solution
Have more specific interfaces for subsets of the functionality provided by ScopedNode - e.g. being able to navigate backwards to your parent, having a Location, having a FhirPath location (something we still need to add), being able to query the type of the instance etc. Method signatures and engines can then be more precise about what is required, and other implementations than ScopedNode can be provided.