AllenNeuralDynamics / aind-data-schema

A library that defines AIND data schema and validates JSON.
MIT License
23 stars 17 forks source link

Refactor _unit fields to rely on a validator instead of always being set #1122

Open dbirman opened 1 week ago

dbirman commented 1 week ago

This PR adds a AindModel validator that checks for fields with the suffix _unit.

If there is a matching variable name for a unit named name_unit then the validator ensures that if name is set, the unit also needs to be set.

If there are multiple variables matching the pattern rootname_* (where * can be anything) for a unit named rootname_unit then the validator ensures that if any of the variables are set, the unit is also set.

dbirman commented 5 days ago

Even though this isn't a breaking change I think it should go in v2 since it changes how a lot of files get generated