Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extensions-Field to GraphQLError.kt #166

Closed
wants to merge 13 commits into from
Closed

Conversation

MaaxGr
Copy link

@MaaxGr MaaxGr commented Oct 14, 2021

Fixes #165

@MaaxGr MaaxGr changed the title Add extensions-Field to GraphQLError.kt WIP: Add extensions-Field to GraphQLError.kt Oct 14, 2021
@MaaxGr MaaxGr changed the title WIP: Add extensions-Field to GraphQLError.kt Add extensions-Field to GraphQLError.kt Oct 20, 2021
@MaaxGr
Copy link
Author

MaaxGr commented Oct 20, 2021

Tested it. Everything works:

throw GraphQLError(message = "test", extensions = mapOf("code" to "BAD_USER_INPUT"))

Returns:

{
  "errors": [
    {
      "message": "test",
      "locations": [],
      "path": [],
      "extensions": {
        "code": "BAD_USER_INPUT"
      }
    }
  ]
}

@jeggy
Copy link
Member

jeggy commented May 31, 2022

Hi @MaaxGr

This looks great!
Could you write a unit test that validates that your implementation also works?

Sorry for this late response.

@MaaxGr
Copy link
Author

MaaxGr commented May 31, 2022

Haha. Yeah of course. Hopefully that also doesn't have to wait for some months :D Let's see, when I have time for that

@jeggy
Copy link
Member

jeggy commented May 31, 2022

Sure :)
And I'm gonna make sure that this repository won't stand stale again.

We have opened GitHub discussions and I'm looking for people to help out #187 Looking for maintainers

@MaaxGr
Copy link
Author

MaaxGr commented Jul 17, 2022

Hey. I have added a unit test to verify the serialize()-Method with extensions-Object included.

But to be honest i now realize that the implementation doesn't exactly matches the spec.

GraphQL services may provide an additional entry to errors with key extensions. This entry, if set, must have a map as its value. This entry is reserved for implementors to add additional information to errors however they see fit, and there are no additional restrictions on its contents.
https://spec.graphql.org/June2018/#example-90475

This example shows that there can also be substructures in one extension, which is currently not supported in my implementation.
https://www.apollographql.com/docs/apollo-server/data/errors/

How sould we deal with this?

@MaaxGr
Copy link
Author

MaaxGr commented Aug 7, 2022

Closing this, as we probably should go with MR #171.

@MaaxGr MaaxGr closed this Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Support for GraphQLError-Extension data
2 participants