[Feature]: Raise warning when a container is not written because it does not map to a spec #1090
Labels
category: enhancement
improvements of code or code behavior
priority: low
alternative solution already working and/or relevant to only specific user(s)
What would you like to see added to HDMF?
When writing extension data, it is easy to create an NWBFile or other container hierarchy with containers that the user thinks maps to a particular part of the extension schema but it doesn't because it is named something else or placed somewhere else. If the container is required according to the spec, then an error is raised. However, sometimes the container is optional. In that case, an error is not raised and the container is silently not written.
Example. The schema says:
The PyNWB code involves creating a container of class
MyContainer
but putting aDynamicTableRegion
namedunits_region
in it. The name does not match the fixed nameunits
in the spec that would allow HDMF to map theDynamicTableRegion
object to theunits
spec. No error is raised and the user is confused as to why theirDynamicTableRegion
was not written.What solution would you like?
When writing containers, we currently go through the spec and pull out the attributes in the container that correspond to the spec. We should also go the other way. Iterate through the children of the container and maybe also all the public attributes and make sure that they all map to something in the spec or are written. Warn if not.
cc @h-mayorquin
Do you have any interest in helping implement the feature?
Yes.
The text was updated successfully, but these errors were encountered: