go icon indicating copy to clipboard operation
go copied to clipboard

Fix #657 incorrect encoding of embedded-recursive types and overlapping tags

Open ngicks opened this issue 2 years ago • 0 comments

Just to explore how to fix #657 .

A simple fix to recursive embedded types is to add recursion check. This, however, breaks other test cases.

I found that it is hard to fix the problem by changing the current resolveConflictBinding implementation, because it does it without field information, while Go's dominantField does it with field info. Adding the overlapping-field-resolver implementation almost identical to that of the std's encoding/json, of course, fixes the problem.

This PR introduces significant changes to the code base (at least it's not like 50 lines fix). So this might not be suitable for the goal of this library.

ngicks avatar Feb 18 '23 16:02 ngicks