Skip to content

WebGraphQlRequest operation(Name) incorrect when multiple queries submitted from GraphiQl interface #741

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

Closed
dbarnhoorn opened this issue Jun 23, 2023 · 2 comments
Assignees
Labels
status: superseded Issue is superseded by another type: regression A bug that is also a regression

Comments

@dbarnhoorn
Copy link

dbarnhoorn commented Jun 23, 2023

The current GraphiQl interface and WebGraphQlRequest are not compatible

spring-graphql 1.1.3 retrieved the key 'operationName' from the post body:
getKey("operationName", body) [in the call to super on line 87]

whilst the current implementation retrieves 'operation':
Object value = body.get("operation"); [in the getOperation method on line 108]

GraphiQl sends a json body containing 'operationName' and 'query' keys and with the current version that results in a
"graphql.execution.UnknownOperationException: Must provide operation name if query contains multiple operations." when sending a document with multiple queries.

I think operationName is the correct name looking at graphql.org, if so the fix would be in retrieving the correct key from the body, otherwise an update to the graphiql javascript (and a change to include that version in the graphiql.html) is probably the solution. (Supporting two keys in case one of the two is empty does not sound like a good solution to me)

Reproducable by starting a project with spring-graphql-1.2.1 and an enabled graphiql interface (spring.graphql.graphiql.enabled: true) and a schema and pasting a simple schema query in the left pane:

query schema1 {
  __schema{
    queryType {
      fields {
        name
      }
    }
  }
}
query schema2 {
  __schema{
    queryType {
      fields {
        name
      }
    }
  }
}

then choosing either of the queries in the dropdown that appears when clicking the 'play' button.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 23, 2023
@rstoyanchev rstoyanchev added type: regression A bug that is also a regression and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 28, 2023
@rstoyanchev rstoyanchev self-assigned this Jun 28, 2023
@rstoyanchev
Copy link
Contributor

This is a regression as a result of #726.

@rstoyanchev rstoyanchev added this to the 1.2.2 milestone Jun 28, 2023
@rstoyanchev
Copy link
Contributor

Superseded by #742.

@rstoyanchev rstoyanchev closed this as not planned Won't fix, can't repro, duplicate, stale Jun 28, 2023
@rstoyanchev rstoyanchev removed this from the 1.2.2 milestone Jun 28, 2023
@rstoyanchev rstoyanchev added the status: superseded Issue is superseded by another label Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded Issue is superseded by another type: regression A bug that is also a regression
Projects
None yet
Development

No branches or pull requests

3 participants