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

Mandatory variable cannot be used for optional argument since apollo-compiler 0.9.0 #558

Closed
yanns opened this issue May 17, 2023 · 1 comment · Fixed by #565
Closed

Mandatory variable cannot be used for optional argument since apollo-compiler 0.9.0 #558

yanns opened this issue May 17, 2023 · 1 comment · Fixed by #565
Assignees
Labels
bug Something isn't working

Comments

@yanns
Copy link
Contributor

yanns commented May 17, 2023

Description

Since the update to apollo-compiler 0.9.0, we have new validation errors that do not seem valid.

Steps to reproduce

Considering the schema like:

type Query {
  category(
    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): Category
}

The following query:

          query CategoryByKey($key: String!){
            category(key: $key) {
              id, key, name(locale:"en")
            }
          }

with the key as variable is not valid anymore.
It fails with variable keycannot be used for argumentkey as their types mismatch

Changing the query to:

          query CategoryByKey($key: String){
            category(key: $key) {
              id, key, name(locale:"en")
            }
          }

works.

Expected result

Not 100% sure, but a mandatory variable can be used for an optional argument.

@yanns yanns added bug Something isn't working triage labels May 17, 2023
@lrlna
Copy link
Member

lrlna commented May 22, 2023

yeppp looks like a bug! thanks for reporting

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