Open rly opened 3 years ago
Question: How to validate against this case:
data_type_def: SpecialVectorData
data_type_inc: VectorData
dtype: text
data_type_def: DynamicTable
datasets:
- data_type_inc: VectorData (validate against this as anonymous spec DynamicTable__VectorData)
name: spike_times
dtype: int
shape: [None]
# question: should this be allowed?
# and what if SpecialVectorData does not specify a dtype?
MyTableBuilder
data type: DynamicTable
datasets:
- data type: SpecialVectorData
name: spike_times
See also https://github.com/hdmf-dev/hdmf-schema-language/issues/13#issuecomment-824249427 for additional best practices
The schema language supports some flexibility in how data types are defined, and some methods are encouraged over others for clarity and consistency. These best practices should be added to the schema language documentation:
quantity
key not in the data type definition but in the group/dataset spec where the type is included. When the data type is defined at the root of the schema (as opposed to nested), then in order to use the data type, a new group (subgroup) spec is defined where thequantity
key is set to a value or if omitted, the default value of 1 would be used. This makes thequantity
defined in the data type definition meaningless and confusing. See also https://github.com/NeurodataWithoutBorders/nwb-schema/pull/472name
key not in the data type definition but iin the group/dataset spec where the type is included. Mismatch between thename
defined on the data type definition and where it is included can lead to confusion in the expected behavior and may lead to errors in HDMF. See https://github.com/hdmf-dev/hdmf/issues/582dtype
,shape
, orquantity
of a data type when usingdata_type_inc
should only restrict the values from their original definitions. For example, if type A hasdtype: text
and type B extends type A (data_type_def: B, data_type_inc: A
), then type B should not redefinedtype
to beint
which is incompatible with the dtype of type A. Same thing if type A is included and a new type is not defined (justdata_type_inc: A
). In other words, all children types should be valid against the parent type. This is not yet checked in HDMF but see progress in https://github.com/hdmf-dev/hdmf/pull/321 .value
anddefault_value
keys are not yet supported by the official APIs, so these are discouraged until support is added.@bendichter @oruebel @ajtritt Can you think of other best practices to add? Do you agree with the above?