REST API: values of relating assocs are not created/updated when request lacks assoc `typeUri`
Example: when creating a person by posting
{
"typeUri": "dmx.contacts.person",
"childs": {
"dmx.contacts.person_name": {
"dmx.contacts.first_name": "Anna",
"dmx.contacts.last_name": "Blum"
},
"dmx.contacts.phone_number#dmx.contacts.phone_entry": [
{
"value": "1 234 567890",
"assoc": {
"childs": {
"dmx.contacts.phone_label": "ref_uri:dmx.contacts.home_phone"
}
}
}
]
}
}
... the phone number will be stored but not the phone label. Note that the phone label is supposed to be stored at the assoc.
To store the phone label in DMX 5.0-beta-3 you would need to set the assoc type (typeUri
):
"assoc": {
"typeUri": "dmx.contacts.phone_entry",
"childs": {
"dmx.contacts.phone_label": "ref_uri:dmx.contacts.home_phone"
}
}
However setting the assoc type is redundant, and the developer should not be required to do so.
The REST API should be improved accordingly.
Note: the Webclient always adds the typeUri
to create/update requests, so the issue only appears when the REST API is accessed by external applications.
This is a follow-up to #219 (closed)