metaverse / truss

Truss helps you build go-kit microservices without having to worry about writing or maintaining boilerplate code.
Other
734 stars 143 forks source link

fix: correctly map request body field by name #327

Open chebykinn opened 3 years ago

chebykinn commented 3 years ago

Hi, I've tried to fix issue #325, this PR should do it.

I've changed the field path to body_root if the current field is mapped by name, which allows setting RequestRootField in gengokit/http_transport.go, which is, in turn, checked in the template to select in which variable body will be deserialized. This fixes the issue in my cases, although maybe it should probably be worth hiding this fix under some option, at least for a few releases to keep backward compatibility.