Closed polfeliu closed 3 years ago
Registers and fields should be given unique names as in the top-level definition the name of that register should be a unique key.
registers:
RegisterA:
# ...
When referring to it in logic, the prefix is used in part to distinguish it from a variable name or other type of value. But there should still only be a single RegisterA
or it should not be correctly validated.
I'm happy to hear that. The issue then is that the validator is not throwing warnings. I'm attaching the modified example file I'm using so you can replicate. See that RegisterA and FieldA are duplicated With the lastest version from PyPi this file is valid. example.zip
Ah when I open this in my code editor the editor is highlighting the error. I would expect the validator to catch this, but I will investigate why it's not.
The yaml loader will override duplicate keys silently rather than throw.
Further discussion in https://github.com/yaml/pyyaml/issues/165
@Fleker I'm wondering if the names of fields or registers are supposed to be unique keys. As far as I understand, duplicate keys in YAML is uncommon, and if we are referencing them as "#/registers/RegisterA" it should only point to one instance. Many devices have fields in different registers that are equally named. We could agree to simply put the "datasheet name" to the title of the field and the field name be whatever unique name we please.
If we agree that fields and registers name are unique keys the issue is very simple: Validator doesn't throw errors for duplicate keys