Clarify rules about custom property names - #2095
Conversation
matthew-white
left a comment
There was a problem hiding this comment.
Questions and comments about these user docs
| Custom Properties let you control which Entities each App User or Public Link receives. For example, if your organization works across multiple regions, you can create a ``region`` Custom Property, assign each App User a region, and configure an :ref:`Entity List access filter <entity-list-access-filter>` so each user receives only Entities from their region. | ||
|
|
||
| Go to the :guilabel:`Custom Properties` tab for a project to see the available Custom Properties and add new ones. Custom Property names follow the same rules as form field names or Entity property names: they can't have spaces in them, must start with a letter, and can only contain letters, numbers, _ or -. | ||
| Go to the :guilabel:`Custom Properties` tab for a project to see the available Custom Properties and add new ones. Custom Property names follow the same rules as form field names or Entity property names: they can't have spaces in them, must start with a letter or underscore, and can only contain letters, numbers, and a limited set of symbols (``_``, ``-``, and ``.``). |
There was a problem hiding this comment.
Here, "letter" isn't restricted to English A-Z. It includes letters with diacritical marks, Chinese characters, etc. So users may still think that the validation is stricter than it actually is.
| Custom Properties let you control which Entities each App User or Public Link receives. For example, if your organization works across multiple regions, you can create a ``region`` Custom Property, assign each App User a region, and configure an :ref:`Entity List access filter <entity-list-access-filter>` so each user receives only Entities from their region. | ||
|
|
||
| Go to the :guilabel:`Custom Properties` tab for a project to see the available Custom Properties and add new ones. Custom Property names follow the same rules as form field names or Entity property names: they can't have spaces in them, must start with a letter, and can only contain letters, numbers, _ or -. | ||
| Go to the :guilabel:`Custom Properties` tab for a project to see the available Custom Properties and add new ones. Custom Property names follow the same rules as form field names or Entity property names: they can't have spaces in them, must start with a letter or underscore, and can only contain letters, numbers, and a limited set of symbols (``_``, ``-``, and ``.``). |
There was a problem hiding this comment.
Should we mention that two leading underscores aren't allowed? How about reserved property names — label, name, displayName?
| Custom Properties let you control which Entities each App User or Public Link receives. For example, if your organization works across multiple regions, you can create a ``region`` Custom Property, assign each App User a region, and configure an :ref:`Entity List access filter <entity-list-access-filter>` so each user receives only Entities from their region. | ||
|
|
||
| Go to the :guilabel:`Custom Properties` tab for a project to see the available Custom Properties and add new ones. Custom Property names follow the same rules as form field names or Entity property names: they can't have spaces in them, must start with a letter, and can only contain letters, numbers, _ or -. | ||
| Go to the :guilabel:`Custom Properties` tab for a project to see the available Custom Properties and add new ones. Custom Property names follow the same rules as form field names or Entity property names: they can't have spaces in them, must start with a letter or underscore, and can only contain letters, numbers, and a limited set of symbols (``_``, ``-``, and ``.``). |
There was a problem hiding this comment.
Code references:
|
I'm wondering where these rules came from in the first place, because they are stricter than the dataset property names, but I didn't happen to implement them in the backend. Should Central be doing more to check properties like this? |
Creating a PR based on getodk/central#1875 (comment)
The rules in the user docs about custom property names are stricter than what Central enforces. In the issue linked to above, there was confusion because a leading underscore actually is allowed. For property names, two leading underscores are disallowed, but one is accepted.
I'll leave a few line comments as well with thoughts about these rules and whether they could be further clarified.