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

bug: TypedGraphQLError that have equal fields do not pass with equals() #700

Closed
clandry94 opened this issue Oct 19, 2021 · 3 comments · Fixed by #702
Closed

bug: TypedGraphQLError that have equal fields do not pass with equals() #700

clandry94 opened this issue Oct 19, 2021 · 3 comments · Fixed by #702
Labels
bug Something isn't working

Comments

@clandry94
Copy link
Contributor

clandry94 commented Oct 19, 2021

Please read our contributor guide before
creating an issue.

Expected behavior

Two TypedGraphQLError error instances that contain the same public fields should pass a equals() check. e.g.

firstError.equals(secondError) should return true when the message, locations, path, and extensions are equal. This makes it easier to compare semantically equal errors to each other during tests and runtime environments.

Actual behavior

Two TypedGraphQLError which contain the same fields return false when compared with equals()

Steps to reproduce

In Kotlin,

val firstError = TypedGraphQLError.newPermissionDeniedBuilder()
            .message("org.springframework.security.access.AccessDeniedException: Access is denied")
            .path(ResultPath.parse("/graphqlendpoint"))
            .build()

val secondError =  TypedGraphQLError.newPermissionDeniedBuilder()
            .message("org.springframework.security.access.AccessDeniedException: Access is denied")
            .path(ResultPath.parse("/graphqlendpoint"))
            .build()
            
firstError.equals(secondError) // false
firstError.toString().equals(secondError.toString()) // true
@clandry94 clandry94 added the bug Something isn't working label Oct 19, 2021
@srinivasankavitha
Copy link
Contributor

Thanks for reporting!

@clandry94
Copy link
Contributor Author

Thanks for ack'ing this 🙂 I can implement the correct behaviour and open a PR for this as well.

@srinivasankavitha
Copy link
Contributor

srinivasankavitha commented Oct 19, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants