We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Related to #81
The same problem I have with other attributes in dicts that must be renamed before actually working with them.
def tranform_data(webhook): return glom(webhook_data, ( Assign('project.id', Spec('project.uid')), # Issue tranformation: Assign('object_attributes.id', Spec('object_attributes.uid')), Assign('issue', Spec('object_attributes')), ))
And then usage:
webhook_data = {'project': {'uid': 1}, 'object_attributes': {'uid': 2}} modified = tranform_data(webhook_data) # => {'project': {'id': 1, 'uid': 1}, 'object_attributes': {'id': 2, 'uid': 2}, 'issue': {'id': 2, 'uid': 2}}
That can quickly become to complex inside, when we really want ot just rename the key. So, that why I suggest to make Rename mutation.
Rename
That's how it would work:
def tranform_data(webhook): return glom(webhook_data, ( Rename('project.id', Spec('project.uid')), # Issue tranformation: Rename('object_attributes.id', Spec('object_attributes.uid')), Rename('issue', Spec('object_attributes')), )) webhook_data = {'project': {'uid': 1}, 'object_attributes': {'uid': 2}} modified = tranform_data(webhook_data) # => {'project': {'id': 1}, 'issue': {'id': 2}}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Related to #81
The same problem I have with other attributes in dicts that must be renamed before actually working with them.
And then usage:
That can quickly become to complex inside, when we really want ot just rename the key.
So, that why I suggest to make
Rename
mutation.That's how it would work:
The text was updated successfully, but these errors were encountered: