angular2-jsonapi icon indicating copy to clipboard operation
angular2-jsonapi copied to clipboard

rename the id field

Open lbertidrwolf opened this issue 5 years ago • 1 comments

It looks like that all models must have an id field called 'id' .What if in my database the unique key identifier of objects is not called id?Is there a way to override the name of the id field?

lbertidrwolf avatar Jul 02 '20 10:07 lbertidrwolf

@lbertidrwolf Hi, you are right that all models MUST have 'id'. This comes from JSON:API Specification. So if You are using different name than 'id', you need to create transformer on your BackEnd side where you transform 'id' to 'other property' before saving to database and back before you send data back to FrontEnd.

michDostal avatar Jul 02 '20 15:07 michDostal