-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Currently the PropertyDescriptionBuilder does not appear to have any failure conditions. However there is at least one condition that a valid property description must satisfy -- if the type is of enum or color, then the format must be specified describing valid variants (for enum) or color formats (for color.)
It looks like today there is nothing preventing an invalid property from being constructed. I can think of a couple of possible avenues here:
- Move the field describing the valid values to
HomieDataType::EnumandHomieDataType::Color. This makes the format impossible to miss specifying, but at the same time it leads to a weird split between types that have an optional format. It also doesn't directly follow the shape of the description JSON anymore; - Make
PropertyDescriptionBuilder::buildfallible (return aResult.) It still makes it possible to construct invalidPropertyDescriptions by building thePropertyDescriptionstructure directly due to its public fields, but perhaps that might even be desired -- if only to handle other device implementations which might have not specified their enum/color formats for whatever reason.
Metadata
Metadata
Assignees
Labels
No labels