-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat(common): Make ParseResult use generic Record type #1321
base: main
Are you sure you want to change the base?
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
5365e73
to
41c3415
Compare
41c3415
to
ac0f8a5
Compare
Let's hold off on this until we get around to refactoring some of our HTTP clients and have a good understanding of where parsing lives there - maybe it can be a part of that. Also, type constraints come with certain limitations. Until then feel free to add functions to common to flatten records, etc |
@RajatPawar Instead I am suggesting to match output of Could we have The generic could be changed to type |
ac0f8a5
to
6df96e6
Compare
6df96e6
to
862e5fa
Compare
862e5fa
to
247223c
Compare
247223c
to
4b23513
Compare
Description
Currently, marshaling records that require extra processing—such as flattening—is not straightforward. Working with records of type
map[string]any
can be cumbersome in such cases, whereas using*ajson.Node
simplifies the process.Solution
common.ParseResult
relies on a generic record type:map[string]any
– Convenient when raw and field values are similar.*ajson.Node
– Requires less code for JSON manipulation and should be used when extracting specific fields.Utilities
Additionaly added a
common.RecordFlattener
method, which moves fields from nested object to the root.Outreach and Klaviyo connectors produce response with similiar structure and would benefit from this method.
The algorithm is the same.