Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Synthetic Fields over existing field paths #54

@bam4564

Description

@bam4564

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions