You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm quite new to GraphQL and I'm struggling with how to translate the concept of the GraphQL interface to proper java code that works with the graphql-java-kickstart library in Spring Boot. I've spent quite some time searching online for answers but could not find a proper working example. Here my simple case I try to figure out:
With the above code, I get an error when I request the additional attribute
# Query
query aQuery {
notification(id: "c782bbb2-7929-4694-9236-8108b49d5ba7") {
id,
title,
description,
isOpened,
sendBy
}
}
# Result
{
"errors": [
{
"message": "Validation error of type FieldUndefined: Field 'sendBy' in type 'Notification' is undefined @ 'notification/sendBy'",
"locations": [
{
"line": 38,
"column": 5
}
],
"extensions": {
"classification": "ValidationError"
}
}
],
"data": null
}
I'm guessing I have to somewhere hint the library what classes implement the interface, so it can do an Instance Of type of thing, but I have no clue where.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey
I'm quite new to GraphQL and I'm struggling with how to translate the concept of the GraphQL interface to proper java code that works with the graphql-java-kickstart library in Spring Boot. I've spent quite some time searching online for answers but could not find a proper working example. Here my simple case I try to figure out:
GraphQL schema
My (bad) translation
With the above code, I can successfully execute the following query that only queries the common attributes
With the above code, I get an error when I request the additional attribute
I'm guessing I have to somewhere hint the library what classes implement the interface, so it can do an Instance Of type of thing, but I have no clue where.
It would be really helpful if an example was added to https://github.com/graphql-java-kickstart/samples
Kind regards for helping me out
Beta Was this translation helpful? Give feedback.
All reactions