-
Notifications
You must be signed in to change notification settings - Fork 6
Description
We have currently been using YAML 1.1 for our device.yml files. The version of the spec allows us to use anchor notion which makes the files far more readable. Unfortunately, some edge cases are unfortunate in this version of the spec (harp-tech/harp-python#49). One of them is how certain keywords are expected to be evaluated to booleans (https://yaml.org/type/bool.html):
true : y | Y | yes | Yes | YES | true | True | TRUE | on | On | ON
false : n | N | no | No | NO | false | False | FALSE | off | Off | OFF
This is mostly ok since people are free to use whatever version they want downstream of the core set of registers. HOWEVER, when combining the core.yml with device.yml in downstream tools (e.g. harp-python), it would be ideal to try to support both versions as much as possible. Currently, I think this edge case is only present in the following line:
Lines 121 to 125 in 09440f3
LedState: | |
description: Specifies the state of an LED on the device. | |
values: | |
Off: {value: 0, description: Specifies that the LED is off.} | |
On: {value: 1, description: Specifies that the LED is on.} |
Where the parsed dictionary keys are, to some YAML parsing implementations, evaluated to booleans. In order to normalize the behavior, I suggest we add make it explicit that these are string identifiers by simply adding optional quotes ("").