Title: Exceptions not working as expected with Directive Wiring · Issue #79 · graphql-java/graphql-java-extended-validation · GitHub
Open Graph Title: Exceptions not working as expected with Directive Wiring · Issue #79 · graphql-java/graphql-java-extended-validation
X Title: Exceptions not working as expected with Directive Wiring · Issue #79 · graphql-java/graphql-java-extended-validation
Description: Describe the bug I'm trying to connect kotlin, spring for graphql, and the validation feature, but when I add the directive wiring, the exceptions thrown in the service layer are not being displayed correctly. Config: @Configuration clas...
Open Graph Description: Describe the bug I'm trying to connect kotlin, spring for graphql, and the validation feature, but when I add the directive wiring, the exceptions thrown in the service layer are not being displaye...
X Description: Describe the bug I'm trying to connect kotlin, spring for graphql, and the validation feature, but when I add the directive wiring, the exceptions thrown in the service layer are not being disp...
Opengraph URL: https://github.com/graphql-java/graphql-java-extended-validation/issues/79
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Exceptions not working as expected with Directive Wiring","articleBody":"**Describe the bug**\r\n\r\nI'm trying to connect kotlin, spring for graphql, and the validation feature, but when I add the directive wiring, the exceptions thrown in the service layer are not being displayed correctly.\r\n\r\nConfig:\r\n```\r\n@Configuration\r\nclass GraphQLConfig {\r\n\r\n @Bean\r\n fun runtimeWiringConfigurer(): RuntimeWiringConfigurer {\r\n val validationRules = ValidationRules.newValidationRules()\r\n .onValidationErrorStrategy(OnValidationErrorStrategy.RETURN_NULL)\r\n .build()\r\n val schemaWiring = ValidationSchemaWiring(validationRules)\r\n\r\n return RuntimeWiringConfigurer { builder: RuntimeWiring.Builder ->\r\n builder.directiveWiring(schemaWiring).build()\r\n }\r\n }\r\n}\r\n```\r\n\r\nController:\r\n ```\r\n @MutationMapping\r\n fun createCourse(\r\n @Arguments createCourseDto: CreateCourseDto\r\n ): CourseDto {\r\n throw RuntimeException(\"exception from controller\")\r\n }\r\n```\r\n\r\nGraphql:\r\n ```\r\ndirective @NotBlank(message : String! = \"graphql.validation.NotBlank.message\") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION\r\n\r\n createCourse(\r\n name: String! @NotBlank\r\n ): Course\r\n\r\ntype Course {\r\n id: ID\r\n name: String\r\n}\r\n```\r\n\r\nWhen I call this endpoint, the result is an empty object, in the background, an exception is being thrown (check the controller snippet above)\r\n\r\n```\r\n{\r\n \"data\": {\r\n \"createCourse\": {\r\n \"id\": null,\r\n \"name\": null\r\n }\r\n }\r\n}\r\n```\r\n\r\nBut If I remove the directive wiring config:\r\n```\r\n//@Configuration\r\n//class GraphQLConfig {\r\n//\r\n// @Bean\r\n// fun runtimeWiringConfigurer(): RuntimeWiringConfigurer {\r\n// val validationRules = ValidationRules.newValidationRules()\r\n// .onValidationErrorStrategy(OnValidationErrorStrategy.RETURN_NULL)\r\n// .build()\r\n// val schemaWiring = ValidationSchemaWiring(validationRules)\r\n//\r\n// return RuntimeWiringConfigurer { builder: RuntimeWiring.Builder ->\r\n// builder.directiveWiring(schemaWiring).build()\r\n// }\r\n// }\r\n//}\r\n```\r\n\r\nI do get the exception as usual:\r\n\r\n```\r\n{\r\n \"errors\": [\r\n {\r\n \"message\": \"INTERNAL_ERROR for a9883b45-f615-258a-4f7a-bda5b432d485\",\r\n \"locations\": [\r\n {\r\n \"line\": 2,\r\n \"column\": 3\r\n }\r\n ],\r\n \"path\": [\r\n \"createCourse\"\r\n ],\r\n \"extensions\": {\r\n \"classification\": \"INTERNAL_ERROR\"\r\n }\r\n }\r\n ],\r\n \"data\": {\r\n \"createCourse\": null\r\n }\r\n}\r\n```\r\n\r\nIs it something wrong with the code, or could this be a bug?\r\n","author":{"url":"https://github.com/jdsalasbarrantes","@type":"Person","name":"jdsalasbarrantes"},"datePublished":"2022-09-27T22:02:46Z","url":"https://github.com/graphql-java/graphql-java-extended-validation/issues/79"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:feb60adb-fe64-e207-7bf4-5689b80dad91 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C622:2E7A8:129037:18CAFB:6B018667 |
| html-safe-nonce | d2f9bc9dbcd85d3d617de23011dfe96a7ec74c6c24b3a8e40bc1d0e6810c41d2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNjIyOjJFN0E4OjEyOTAzNzoxOENBRkI6NkIwMTg2NjciLCJ2aXNpdG9yX2lkIjoiMzg5Mzg2ODk5MDc0MDY2MTg2MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 27d9765e048599b128c6a21e68d9fcc24314e6d81862930deeecaf2c253d65f4 |
| hovercard-subject-tag | issue:1388433036 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/graphql-java/graphql-java-extended-validation/79/issue_layout |
| twitter:image | https://opengraph.githubassets.com/000a0f4a9e2b9fb1185d21bef32bc7b5c0576dadeaf47518b95590412afe25c8/graphql-java/graphql-java-extended-validation/issues/79 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/000a0f4a9e2b9fb1185d21bef32bc7b5c0576dadeaf47518b95590412afe25c8/graphql-java/graphql-java-extended-validation/issues/79 |
| og:image:alt | Describe the bug I'm trying to connect kotlin, spring for graphql, and the validation feature, but when I add the directive wiring, the exceptions thrown in the service layer are not being displaye... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jdsalasbarrantes |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/graphql-java/graphql-java-extended-validation git https://github.com/graphql-java/graphql-java-extended-validation.git |
| octolytics-dimension-user_id | 14289921 |
| octolytics-dimension-user_login | graphql-java |
| octolytics-dimension-repository_id | 205507809 |
| octolytics-dimension-repository_nwo | graphql-java/graphql-java-extended-validation |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 205507809 |
| octolytics-dimension-repository_network_root_nwo | graphql-java/graphql-java-extended-validation |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width