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: UnknownOperationException should return 400 instead of 500 #1751

Closed
pjungels-paraport opened this issue Dec 21, 2023 · 2 comments · Fixed by #1760
Closed

bug: UnknownOperationException should return 400 instead of 500 #1751

pjungels-paraport opened this issue Dec 21, 2023 · 2 comments · Fixed by #1760
Labels
bug Something isn't working

Comments

@pjungels-paraport
Copy link

Expected behavior

{ "operationName": "books", "variables": {}, "query": "{ books {\nid\nname\n} }" }
When this type of request/query is submitted (note, the operationName "books" without a matching named query), an UnknownOperationException is thrown from graphql.language.NodeUtil. When an UnknownOperationException is thrown, the result should be ResponseEntity.badRequest... since it is a malformed request.

Actual behavior

When this type of query is submitted and an UnknownOperationException is thrown, the current behavior is that an Internal Server Error is returned to the caller.

Steps to reproduce

Submit a named query with non-matching operationName. Or submit a non-named query with any operationName specified. Or submit two named queries without an operationName specified.

@pjungels-paraport pjungels-paraport added the bug Something isn't working label Dec 21, 2023
@pjungels-paraport
Copy link
Author

Looks like I don't have access to create a branch/submit a pull request. Can I get access? Otherwise I can just share the code here.

@paulbakker
Copy link
Collaborator

Looks like I don't have access to create a branch/submit a pull request. Can I get access? Otherwise I can just share the code here.

The common workflow on Github is to fork the repo to your personal account, and create a PR from there to the the main repo.

kilink pushed a commit that referenced this issue Jan 2, 2024
When GraphQL.executeAsync throws UnknownOperationException, or any exception implementing GraphQLError,
set the status to BAD_REQUEST / 400 in BaseDgsQueryExecutor. Fixes #1751.
kilink pushed a commit that referenced this issue Jan 8, 2024
When GraphQL.executeAsync throws UnknownOperationException, or any exception implementing GraphQLError,
set the status to BAD_REQUEST / 400 in BaseDgsQueryExecutor. Fixes #1751.
kilink pushed a commit that referenced this issue Jan 9, 2024
When GraphQL.executeAsync throws UnknownOperationException, or any exception implementing GraphQLError,
set the status to BAD_REQUEST / 400 in BaseDgsQueryExecutor. Fixes #1751.
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