Optional runtime-checks to prevent unintuitive effects due to schema inheritance #7
Labels
enhancement
New feature or request
internals
Technical and subtle issues users are (usually) not aware of
When packing a container, it should be ensured that at each node following property holds:
Parent compatibility: Each attached metadata object can be parsed as all parent/ancestor types
Parent consistency: Two objects for two schemas sharing some parent schema should agree on the parent-parse of the objects
The first one is crucial for the granular query to work correctly at all, and should also be checked in tests by schema developers.
The second one is required to avoid "undefined behavior" when asking for an object of a more general type (it might be surprising that you get "any" suitable child and if they don't agree, ultimately get different metadata), and this cannot be checked as it is instance-dependent.
Doing this during
MetadorContainer
modifications adds some little overhead during container creation, but could catch mistakes and assuming that a container is mostly read and usually created once, is very worth it.On modifications of metadata:
Parent compatibility should be covered in test cases, but these are never perfect. This would give a guarantee for the concrete instance that it actually works.
This would work, assuming the existing metadata is already consistent (otherwise every "bundle" needs to be checked, this would be more expensive, but of course possible when doing a consistency check of an existing container)
The text was updated successfully, but these errors were encountered: