-
Notifications
You must be signed in to change notification settings - Fork 261
fix: allow users to specify extraction path #2497
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
fix: allow users to specify extraction path #2497
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2497 +/- ##
=======================================
Coverage 87.29% 87.30%
=======================================
Files 253 253
Lines 23679 23678 -1
=======================================
Hits 20671 20671
+ Misses 3008 3007 -1 ☔ View full report in Codecov by Sentry. |
This is really, really nice! 🫶 I was able to check this PR locally and test it out. It's even better than I expected, because you basically solved my two concerns from #2471. Although it fits my use case, I feel like making the batching work with nested resources should be separeted from "extracting" or flattening the resource. For example, it's the not case here but I could want to access More importantly it seems there's an batching issue 🤔
Here I am also batching other resources (here memberships and teams), which seem to work fine. But there is two calls to |
@angristan yes, i agree with you that problem exists. when you do batching it basically strips out all the contents from API response and only keeps the json object mentioned in extraction_path. |
Summary:
problem: when we specify the batchKey: ["a","b"] we essentially expect the path to target and assume the last value to be the query param key.
eg.
in the discussion example,
batchKey: ["bank_accounts", "id"]
, tells the serverid
will be used for the extraction of json item from batched endpoint's response andid
will be used form a batched end point which isn't the case when extraction property name is different than the name used to form batched endpoint. so we need more information in order to solve this problem.proposed solution:
here we tell form the endpoint with batchKey and use extraction path for extract the json object from batched endpoint.
i.e when creating batched endpoint use
bank_account_ids[]
and in the batched endpoint response go tobank_accounts.id
to figure out merging.Issue Reference(s):
Fixes #2489
/claim #2489
Build & Testing:
cargo test
successfully../lint.sh --mode=fix
to fix all linting issues raised by./lint.sh --mode=check
.Checklist:
<type>(<optional scope>): <title>