subgrounds icon indicating copy to clipboard operation
subgrounds copied to clipboard

Synthetic Fields over existing field paths

Open bam4564 opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe.

A lot of times, what I want to perform when creating a synthetic field is to post-process the queried value of a field path but retain the same name.

Describe the solution you'd like For example

# Converting decimals for an erc20 token amount transparently 
subgraph.Entity.token_amount = subgraph.Entity.token_amount / 1e6 

This is pretty easy to do in post-processing, but I thought it might be nice to have as a capability for synthetic fields.

Describe alternatives you've considered

When I tried to do something like this for a subgraph I'm working with, I got the following error. At the very least, it would be nice to have a more descriptive error message about this behavior not being allowed.

Exception: transform_response: data for selection Selection(fmeta=TypeMeta.FieldMeta(name='order', description=None, arguments=[], type_=TypeRef.Named(name_='PodOrder')), alias=None, arguments=[], selection=[Selection(fmeta=TypeMeta.FieldMeta(name='status', description=None, arguments=[], type_=TypeRef.NonNull(inner=TypeRef.Named(name_='String'))), alias=None, arguments=[], selection=[]), Selection(fmeta=TypeMeta.FieldMeta(name='pricePerPod', description=None, arguments=[], type_=TypeRef.NonNull(inner=TypeRef.Named(name_='Int'))), alias=None, arguments=[], selection=[])]) is neither list or dict None

Additional context N/A

Implementation checklist N/A

bam4564 avatar Sep 03 '22 02:09 bam4564