Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render with ObjectDict() for a Single Object with TMVCSerializationAction #430

Closed
sonjli opened this issue Oct 1, 2020 · 3 comments
Closed
Assignees
Labels
accepted Issue has been accepted and inserted in a future milestone bug
Milestone

Comments

@sonjli
Copy link

sonjli commented Oct 1, 2020

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.

Eddy
MVCFramework.Serializer.JsonDataObjects.zip

@danieleteti
Copy link
Owner

Thank you for your analysis. I'll get into it ASAP.

@sonjli
Copy link
Author

sonjli commented Oct 1, 2020

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
Copy link
Owner

Patch integrated (with s small change). Thank you.

@danieleteti danieleteti added accepted Issue has been accepted and inserted in a future milestone bug labels Nov 13, 2020
@danieleteti danieleteti added this to the 3.2.1-carbon milestone Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Issue has been accepted and inserted in a future milestone bug
Projects
None yet
Development

No branches or pull requests

2 participants