We use a single Query to request different types of information. In order to distinguish the items returned, the __typename attribute is used.
aws-appsync returns and displays the __typename attribute, even it is not in the provided schema.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
In order for Graphql to distinguish the items, the __typename attribute is required.
In our case, our resolvers are taking care of it and you see that there is no notion of the __typename attribute in the schema.
Example schema:
interface News {
id: String
}
type Post implements News {
author: String
text: String
}
type Article implements News {
author: String
text: String
headline: String
}
type NewsList {
items: [News]
}
type Query {
listNews(): NewsList
}
and a query would look like this:
query ListNews() {
listNews() {
items {
... on Article {
author
text
headline
}
... on Post {
author
text
}
}
}
}
Response:
{
data: {
listNews {
items: [
{
"author": "ABC",
"text": "Blabla123",
"__typename": "Post" # <-- this attribute should not be there
},
{
"author": "ABC",
"text": "Blabla123",
"Headline": "BLABLA",
"__typename": "Article" # <-- this attribute should not be there
}
]
}
}
}
What is the expected behavior?
The expected behavior is, that the __typename attribute is not returned to the client.
Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? Did this work in previous versions?
I am using "aws-appsync": "^4.0.0" in Lambda with runtime Nodejs 10.x.
Since I am using your sdk for the first time, I haven't tried any other versions.
Do you want to request a feature or report a bug?
I want to report a bug.
What is the current behavior?
We use a single Query to request different types of information. In order to distinguish the items returned, the
__typename
attribute is used. aws-appsync returns and displays the__typename
attribute, even it is not in the provided schema.If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
In order for Graphql to distinguish the items, the
__typename
attribute is required. In our case, our resolvers are taking care of it and you see that there is no notion of the__typename
attribute in the schema. Example schema:and a query would look like this:
Response:
What is the expected behavior?
The expected behavior is, that the
__typename
attribute is not returned to the client.Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? Did this work in previous versions?
I am using
"aws-appsync": "^4.0.0"
in Lambda with runtime Nodejs 10.x. Since I am using your sdk for the first time, I haven't tried any other versions.