data
data copied to clipboard
`serializeResources` has `id: null` which will be shipped as payload on create record
Using schema records (only warp-drive packages) i have discoverd this issue...
const editableHotelUser = this.store.createRecord<EditableLoginUser>(
'login/user',
{
userName: 'My user',
emailAddress: '[email protected]',
},
);
await this.store.request(createRecord(editableHotelUser));
is shipping to server:
{
"data": {
"type": "login/user",
"id": null,
"lid": "03cf1558-e190-49b0-8650-f75c04710b0a",
"attributes": {
"userName": "My user",
"emailAddress": "[email protected]",
"guid": null
}
}
}
Looking the json api (https://jsonapi.org/format/#crud-creating), by following resource object link (https://jsonapi.org/format/#document-resource-objects) i have found this:
Exception: The id member is not required when the resource object originates at the client and represents a new resource to be created on the server. In that case, a client MAY include a lid member to uniquely identify the resource by type locally within the document.
and
The values of the id, type, and lid members MUST be strings.
Does this mean that we should remove id: null inside serializeResources?
Version: Ember: 6.6 EmberData: 5.6