---
# System prepended metadata

title: Optional Features – feature toggles

---

# Optional Features -- feature toggles

Features are optional meaning they are disableable. We turn them on, i.e., using ENV var.

## `Comment field` feat

- each "leaf", i.e., an input, textarea etc, field gets additional "thing" that enables to add comments to the field. It is basically additional metadata about the field, for example, if fulfilling the field properly is difficult, the form data consumer is aware. Options we have:
  - checkbox with label `add comments`. Once it is checked, additional textarea appears right below the field it is about. Maybe put into a dialog? 
  - An icon added to the field label that shows a dialog. Dialog has textarea to add comments. Once saved, the comments appear below the field with the ability to edit.
- feat integration must not need additional `comments REFERENCE[SAID]` attribute on the root bundle level. Otherwise it requires a lot of changes and is barely integratable. We instead provide the final data as: `{ "bundle data": { data }, "comments": { ... } }`. `comments` has a flat structure thanks to the JSON patch mechanics, i.e. `{ "store.devices.5.water_lvl": "Device doesn't work cannot check." }`


Alternative proposition:

Allow user to provide reasoning why he is breaking the rules, the rule is that field is mandatory but if the have a good reason why he cannot obey to the rule he could continue. Analogy would be to interact with Human over the phone or in phisical world -> 0,1 vs spectrum of options

When error appears for any type of the issues user should have possibility to "argue" and provide the reason why he cannot fill proper value. It should show only after seeing the error. It should be generic capture attached to any bundle, means no need to modify the bundle to have that feature.

![image](https://hackmd.io/_uploads/S1Ln_GJ1A.png)

The "reason/commnets" could have it's own definition (bundle) which provide possibility to capture not only free form text (comment) but as well choose the reason from the list, including translations.




## `Resize imgs` feat 🔥

- each asset of type image gets resized (scaled) automatically to reduce the img size by half or more.
- we initially must read the current img metadata and check the img resolution. Upon it and the size of the file we automatically decide how to resize the source img. 
- apart from resizing, we must generate thumbnails of uploaded imgs. 