hdmf-dev / hdmf

The Hierarchical Data Modeling Framework
http://hdmf.readthedocs.io
Other
48 stars 26 forks source link

add ability to specify enumerated types #330

Open ajtritt opened 4 years ago

ajtritt commented 4 years ago

This field in the NWB schema specifies a text field that can take on one of three values. The ability to formally specify these values in the specification will make it possible to validate this field against the specified.

The YAML for this would look something like this:

name: <NAME>
dtype: <DTYPE>
enum:                  <--- new argument for a dataset or attribute specification
    - <OPTION_1>
    - <OPTION_2>
    - <OPTION_3>
required: true|false
...

(We don't need to use options as the key)

rly commented 4 years ago

@bendichter says json-schema uses the key "enum" so we should use that too.

bendichter commented 4 years ago

https://json-schema.org/understanding-json-schema/reference/generic.html#enumerated-values