Add best practices section #14
Labels
category: enhancement
improvements of code or code behavior
priority: low
alternative solution already working and/or relevant to only specific user(s)
topic: docs
Issues related to documentation
Milestone
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 Remove quantity from OptogeneticStimulusSite and ImagingPlane definitions NeurodataWithoutBorders/nwb-schema#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 Mismatched fixed name and included name causes errors on read/validate hdmf#582data_type_inc
#13. -- Make this a rule (stop allowing new specs with this)dtype
,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 Pass parent properties to extended dataset/attribute hdmf#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?
The text was updated successfully, but these errors were encountered: