Serialize pluralType not working for relationships
ajmathews opened this issue · comments
Ashwin Mathews commented
My object has a child relationship. The pluralizeType
doesn't seem to be working on it. I require the type to be singular. For example,
test = {
name: 'this is the name',
description: 'this is the desc',
kids: [
{ id: 20 },
{ id: 22 },
{ id: 24 }
]
};
const roleSerializer = new Serializer('parent',
{
attributes: ['name', 'description', 'kids'],
pluralizeType: false,
kids: {
ref: 'id',
pluralizeType: false
}
}
);
const body = roleSerializer.serialize(test);
The response I am getting is as below,
I expect type: "kids"
to be type: "kid"
. Can some one suggest as to what I might be doing wrong?
Thanks
Ashwin Mathews commented
I looked at the code and it seems you guys don't make it singular and only the reverse. Also read up on the issue #12 . Wondering whether this is a feature that you guys see as useful?
Ashwin Mathews commented
Pull Request - #166