-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Adds resource field reference syntax to template strings #2210
base: devel
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for dlt-hub-docs canceled.
|
40d5201
to
5c1e6b2
Compare
5c1e6b2
to
6ac4fdc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some comments to the code. Tests look good though. What is still missing:
- examples (github/demo pipeline - incremental) not converted to a new notation
- I do not see tests that use invalid placeholders
- {unknown.attr}
- {incremental.unknown}
- a test where we define several parent resources ie. {resources.issue.id} and {resources.posts.id} in the same resource. I think that there's universal check for those but it makes sense to check it
if isinstance(obj, str): | ||
return obj.format(**placeholders) | ||
|
||
if isinstance(obj, dict): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could replace recursive code with utils.map_nested_in_place
and just provide lambda obj: obj.format() as mapping function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer keeping the non-mutating way here rather than changing the dict in place.
- Add support for interpolating in query and json parameters - Stricter validation for resource params - Refactor path and parameter binding - Error handling for invalid resource params
- Generalize context validation for path and parameter interpolation - Add parameterized test for incorrect interpolation scenarios
Resolves #2190
Implements #1880 by introducing
incremental
context object.