Couch stores JSON docs without any schema. The CHT allows for writing custom fields for reports/contacts via the open-ended form configuration.
At the same time, the CHT system relies on a certain amount of expected structure to exist on this docs (e.g. type
, name
, date_of_birth
, etc.). The question that has come up (in the context of a separate discussion) is how devs (both ones working on cht-core and devs making app configurations) are supposed to know what these special fields are (without memorizing the entire docs site).
AFIK we don’t have a list of “reserved fields” documented anywhere. Even if we did, as a core developer, how could I go about adding fields to that list without worrying about collisions with existing custom fields?
In the above-linked issue thread, we have been discussing the possibility of some kind of standard prefix for fields like this. So instead of is_canonical
, we would call the field something like cht_is_canonical
or _is_canonical
. Some kind of prefix indicator for the field names seems useful because:
- App developers can know not to use the prefix for any custom fields when writing form configuration.
- Core developers can know that fields with that prefix should be safe from collisions with custom fields.
Throwing this thread out here to see if anyone has more thoughts/ideas/opinions on how to handle this! Thanks!