Replies: 10 comments 2 replies
-
Take a look at the original GraphQLErrorBuilder for inspiration. You have to add the |
Beta Was this translation helpful? Give feedback.
-
Unfortunately this had no effect: still no extensions, locations or path in the errors :/ |
Beta Was this translation helpful? Give feedback.
-
I don't know what you actually did now, but I hope you at least removed your getters for locations, path and extensions from your custom implementation. Seeing that you return empty or null there which explains why they are not present in the response. |
Beta Was this translation helpful? Give feedback.
-
Well the validator now returns a list of GraphqlErrorBuilder.newError(environment)
.errorType(YAMLErrorType.DocumentValidationError)
.message(validationError.getRootProblem())
.extensions(validationError.getExtensions())
.build(); So yes, the returned |
Beta Was this translation helpful? Give feedback.
-
I even tried return again instances of To be frank, I don't really care that locations and path are missing, I just need the extensions to show up, as they will offer more detailed messages where and why the document validation failed. |
Beta Was this translation helpful? Give feedback.
-
Try enabling |
Beta Was this translation helpful? Give feedback.
-
I have it enabled already :/ And disabling it causes some misery with GraphiQL (can't get any response). |
Beta Was this translation helpful? Give feedback.
-
@Eetami Did you ever get this to work or still a problem? |
Beta Was this translation helpful? Give feedback.
-
Hey @oliemansm I think I found out the cause. After some testing I could not repro this issue in my sandbox project. Though I noticed that in the erronous project we had property Though now I have a problem that when attempting to use my own error class, the response from GraphQL API is empty. edit: I was able to fix the issue. The main problem was that GraphQL servlet swallowed a JSON serialization exception, so I had to increase log level to debug to see it. After that it was smooth sailing. I'll add a link to the swallowing issue for future reference: graphql-java-kickstart/graphql-java-servlet#250 Perhaps the exception should be propagated to Spring exception handlers, so that the developer can see the stack trace even when log level is not debug. |
Beta Was this translation helpful? Give feedback.
-
Hi, I think I have a similar issue. From one of my resolvers I am returning:
With while if I set
This behaviour is from
Is this intended or it's a bug? |
Beta Was this translation helpful? Give feedback.
-
I have a schema akin to the following
And resolver classes for both Query and DocumentWrapper
The DocumentValidator returns a list of errors that are of type DocumentValidationError
With this setup I can get both the data and errors in the query response, BUT in the errors I get only the message, not extensions, locations or path. How can I get the extensions, locations and path showing in the query response in case there are validation errors?
Beta Was this translation helpful? Give feedback.
All reactions