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

Fallback for the query operationName value #203

Open
slavik-pastushenko opened this issue Oct 25, 2023 · 1 comment
Open

Fallback for the query operationName value #203

slavik-pastushenko opened this issue Oct 25, 2023 · 1 comment

Comments

@slavik-pastushenko
Copy link

Hello!
I am trying to migrate to this gateway and realised that I am not able to execute a query without specifying the operationName, meaning this query throws an exception:

query {
  random(id: "id") {
    id
    name
}

Looks like this is the place where we validate the operationName field: https://github.com/nautilus/gateway/blob/master/gateway.go#L69

Is it possible to set the fallback value instead of throwing an exception?
As an example: solution

@JohnStarich
Copy link
Member

@slavik-pastushenko I agree, operationName should definitely be optional. What's weird is I'm not able to reproduce on the latest version 🤔 Do you have additional queries in your request?

I used the gateway example "hello" here with operationName set to null (not provided) and "" successfully:
image

From the code you've linked, I think that should only be hit if you have more than one operation in your query. In other words, gateway only requires the operation name when it's ambiguous which operation it should run.

I know it's been a few months since you opened this, but is this still happening for you? If you have an example with steps to reproduce, I can help dig into this further with you.

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

No branches or pull requests

2 participants