feat(codec): JSON Record decorator#2248
Merged
Merged
Conversation
This was referenced Oct 31, 2025
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Oct 31, 2025
2d13aed to
8a46341
Compare
94c3e21 to
483ce73
Compare
483ce73 to
fbedc4a
Compare
8a46341 to
1863886
Compare
fbedc4a to
deb0891
Compare
1863886 to
420d747
Compare
anushat05
approved these changes
Nov 4, 2025
deb0891 to
a2ad746
Compare
420d747 to
aec7c2b
Compare
Base automatically changed from
cobalt0s/client-custom-err-conditional
to
main
November 5, 2025 00:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
This utility simplifies constructing payloads from records in Go, especially for Salesforce API integration.
In Go, anonymous struct embedding works perfectly for structs: embedded fields are injected at the same level, so you can compose a final JSON body from multiple structs and every field is "inherited" naturally on the same JSON node level.
However, this approach doesn’t work for non-struct properties.
common.Recordis amap[string]any, so a special decorator is required to merge additional properties.For Salesforce, the difference between the client-supplied record and the payload is that we must:
This utility makes it easy to create a Salesforce-ready model (NOTE: there is some existing code in some connector that also does side-car property emebeding which would benefit from it). During JSON marshaling, properties from

Extensionare automatically merged intoRecord.Input:
Output: