nuxt-modules / nuxt-modules/shopify

Auto-generate query names for anonymous GraphQL queries

Open
#225 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement nice-to-have
Dominant language
TypeScript
Stars
182
Forks
13
Avg merge
14h 31m
Merged PRs (30d)
10

Description

For the type generation to work, GraphQL queries have to have a unique name.

works:

query GetCustomer {
  customer {
    firstName
    lastName
  }
}

doesn't work:

query {
  customer {
    firstName
    lastName
  }
}

Since we control the type generation and have access to the originating file name, contents, etc. it would be possible to auto-generate missing query names. This should be behind a configuration flag, but if it turns out to be viable and stable it should be enabled by default with a possibility to opt-out.

Name generation has to be unique enough that multiple queries can be created in the same file without a name and still get the correct types.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the type-generation entry point and existing configuration handling, then trace how the originating file and query contents are passed through. Add focused coverage for multiple anonymous queries in one file and for the configuration flag; done means generated types remain correctly associated with unique generated names and named queries continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.