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

[graphiql] Fragment variables not supported #3568

Open
1 task done
gerdemb opened this issue Mar 25, 2024 · 4 comments
Open
1 task done

[graphiql] Fragment variables not supported #3568

gerdemb opened this issue Mar 25, 2024 · 4 comments

Comments

@gerdemb
Copy link

gerdemb commented Mar 25, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

  fragment Fragment on AccountsConnection {
    nodes {
      id
      name
      balance(endDate: $date) {
        number
        currency
      }
    }
  }

  # ERROR Variable "$date" is never used in operation "Accounts".GraphQL: Validation
  query Accounts($startsWith: String!, $date: Date = "2024-03-24") {
    accounts(filter: { name: { startsWith: $startsWith } }, orderBy: NAME_ASC) {
      ...Fragment
    }
  }

Has flag this validation error on the Account query: Variable "$date" is never used in operation "Accounts".GraphQL: Validation. Actual code works as expected.

graphql.config.js

const config = {
  schema: "http://ds720.local:3000/graphql",
  documents: ["app/**/*.tsx"],
};

Using VSIX release found here: #3521

Expected Behavior

Doesn't show validation error.

Steps To Reproduce

No response

Environment

Anything else?

No response

@acao
Copy link
Member

acao commented Mar 26, 2024

this just means we need to update graphql, or we need to re-use the version in the project if it's available. these rulesets are entirely determined by the graphql version the LSP is shipping with currently

@gerdemb
Copy link
Author

gerdemb commented Mar 26, 2024

I am having this problem only intermittently so I suspect it may be something wrong with my development environment. Feel free to close this issue if you think it's not related to this package.

@acao
Copy link
Member

acao commented Apr 5, 2024

Thank you! It still may be a problem on our end if I'm incorrect, so I'm going to keep this open until I have time to add tests to confirm that it works as it should, and fix the bug if not

@acao
Copy link
Member

acao commented May 1, 2024

it appears we're still bundling with the latest version of graphql, so perhaps the latest specifiedRules still need to be updated to make this the default? these are what we use as the default rules for validation, and then the custom validation rules can be specified. if there is something we need to override to make this possible we can - for example, replacing the rule i linked to with another that supports fragment variables, or whatever path they chose to implement this spec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants