-
Notifications
You must be signed in to change notification settings - Fork 58
Description
Description
When using an attribute with a defaultValue
set in the editor, e g
[
{
"name": "skapad_av",
"title": "Skapad av: ",
"type": "hidden",
"defaultValue": {
"type": "sessionStorage",
"key": "loggedInUser",
"updateOnEdit": false
}
}
]
the value in the session storage variable is used as-is. Often, e g when using the OIDC-plugin, the value of interest is actually a child object within a JSON block.
It would be great if there was a possibility to specify what specific object within a JSON parent object is supposed to be used as the default value.
Describe the solution you'd like
A new defaultValue config parameter: keyType
.
By default, the current behaviour is kept - getting the variable that matches key
exactly. If set to "json_path"
, a child object can be referenced with simple dot notation, e g "key": "oidc_user.displayname"
in the case of the OIDC-plugin.
[
{
"name": "skapad_av",
"title": "Skapad av: ",
"type": "hidden",
"defaultValue": {
"type": "sessionStorage",
"key": "oidc_user.displayname",
"keyType": "json_path",
"updateOnEdit": false
}
}
]
Describe alternatives you've considered
Handling some sort of general or JSON-specific attribute transformation before an attribute is applied could be useful sometimes but would be a more complex solution.
EDIT: Updated the proposed solution to reflect the discussion on the last developer meeting.