Open joesiltberg opened 4 years ago
Something similar to Bash's default parameter expansion could be interesting as well:
"schoolYear": "${schoolYear:-1}", or: "schoolYear": "${schoolYear-1}" since we don't really have null values.
Make sure to check rules for LDAP naming rules for attributes before choosing a syntax (can they include ':' or '-'? Can they start with '-'?)
See also:
https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
Consider also the use case where the existence of an LDAP-attribute can be used to decide the value of a SCIM-attribute. For instance, if an LDAP-group has the attribute x, it should have studentGroupType "Undervisning", but if the attribute is missing it should be "Klass".
${ifdef ...} with an else-clause could solve that, or Bash's ":+" expansion.
If we use a variable replacement in a JSON template, and the corresponding attribute is missing in LDAP for some objects that will give error messages.
Sometimes, for optional fields, we may want to have a way of sending them only if they exist. Maybe something like:
${ifdef schoolYear} "schoolYear": "${schoolYear}" ${end}