Aliasing a field not working #892
chirdeeptomar
started this conversation in
General
Replies: 1 comment 4 replies
-
https://ariadnegraphql.org/docs/api-reference.html#set_alias
What you want to do is: user = ObjectType("Query")
user.set_alias("topMetric", "top_metric")
user.set_alias("topAuthors", "top_authors") |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a top level field on the Query object called topMetric (which is a generic method) to return top_book, top_authors etc, takes an Emum to distinguish what to return.
As the field is named as topMetric in the schema, in the output I get "topMetric" under "data" node. I would like to rename that in the resolver based on the type of metric requested from the user.
user = ObjectType("Query")
user.set_alias("topMetric", "topAuthors")
Above did not work for me. Appreciate any help.
Beta Was this translation helpful? Give feedback.
All reactions