Render with ObjectDict() for a Single Object with TMVCSerializationAction
sonjli opened this issue · 3 comments
sonjli commented
Hello.
I don't know if this is a real issue so I explain my case:
I have a EntityProcessor that have to add some HATEOAS links to a Entity
Case 1: In GetEntites I do:
var
lEntities: TObjectList<TMacchinaUser>;
...
Renderer.Render(ObjectDict().Add('data', lEntities, RicettaEsplosaLink))
// RicettaEsplosaLink is a TMVCSerializationAction
Case 2: In GetEntity I do:
var
lEntities: TMacchinaUser;
...
Renderer.Render(ObjectDict().Add('data', lEntities, RicettaEsplosaLink)) as for GetEntities
// RicettaEsplosaLink is a TMVCSerializationAction
In second case the rendered JSON is WITHOUT the links.
After some debugging I think I found the "problem". I attach the "MVCFramework.Serializer.JsonDataObjects.pas" with my edit at line 573.
I hope this can help.
danieleteti commented
Thank you for your analysis. I'll get into it ASAP.
sonjli commented
FYI
I don't use the form Renderer.Render(200, lEntities, RicettaEsplosaLink) (Without ObjectDict()) because i need the "data" object that surrounds the entity.
Thanks
Eddy
danieleteti commented
Patch integrated (with s small change). Thank you.