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

Documentation is incorrectly inferred for arguments #10205

Open
bigtimebuddy opened this issue Nov 26, 2024 · 0 comments
Open

Documentation is incorrectly inferred for arguments #10205

bigtimebuddy opened this issue Nov 26, 2024 · 0 comments

Comments

@bigtimebuddy
Copy link

Which packages are impacted by your issue?

@graphql-codegen/cli, @graphql-codegen/typescript

Describe the bug

Here's a basic example of codegen two TS schemas. You can see that QueryColorAllArgs is incorrectly documented. Unclear why it's getting the Query documentation (4) from version.ts.

colors.ts

export default gql`
  "1. Queries for retrieving colors"
  type Query {
    "2. Returns all colors"
    colors(
      "3. Filter colors by scope"
      scope: [String]
    ): [String]
  }
`;

versions.ts

export default gql`
  "4. Queries for retrieving available versions"
  type Query {
    "5. Returns all available versions"
    versions: [String]
  }
`;

types.ts

/** 4. Queries for retrieving available versions */
export type Query = {
  __typename?: 'Query';
  /** 2. Returns all colors */
  colors?: Maybe<Array<Maybe<Scalars['String']['output']>>>;
  /** 5. Returns all available versions */
  versions?: Maybe<Array<Maybe<Scalars['String']['output']>>>;
};


/** 4. Queries for retrieving available versions */
export type QueryColorsArgs = {
  scope?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
};

Your Example Website or App

https://github.com/bigtimebuddy/graphql-codegen-bug

Steps to Reproduce the Bug or Issue

  1. Clone repo (https://github.com/bigtimebuddy/graphql-codegen-bug)
  2. Run npm install
  3. Run npm test
  4. See src/generated/types.ts

Expected behavior

I'm expecting argument comments from the schema to get correctly assigned in the output arg types OR at show no comments. Comments are incorrect assigned from another schema.

Screenshots or Videos

No response

Platform

  • OS: macOS
  • NodeJS: v18.20.5
  • @graphql-codegen/cli version: 5.0.3
  • @graphql-codegen/typescript version: 4.1.2

Codegen Config File

overwrite: true
generates:
./src/generated/types.ts:
schema:
- "src/schemas/*.ts"
plugins:
- "typescript"

Additional context

No response

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

1 participant