Skip to content

Conversation

@ikusakov2
Copy link

@ikusakov2 ikusakov2 commented Jan 7, 2026

Description

This PR includes an integration test which displays issues with the recent version.

Integration tests location:

dev-test-alpha/

How to compile:

in the repo root run:

yarn build

in the dev-test-alpha/ run:

cd dev-test-alpha
yarn install 

and see that everything compiles

How to run:

in the dev-test-alpha/ run:

yarn start

Demonstrated issues:

Check the dev-test-alpha/src/__generated__/* files.

  1. The following line should not be included:
import type * as Types from '../../graphql-code-generator/dev-test-alpha/src/__generated__/globalTypes';
  1. Types. prefix should not be included for Types.UserManagerRoleType

  2. UserManagerRoleType definition should be included in src/__generated__/Component.ts file (like it is included in src/__generated__/Helper.ts)

Update: I've added a potential fix + unit tests for the last issue.

@ikusakov2 ikusakov2 changed the title An intergration test showing errors with recent alpha version An integration test showing errors with recent alpha version Jan 7, 2026
@ikusakov2 ikusakov2 changed the base branch from master to master-next January 7, 2026 20:27
@changeset-bot
Copy link

changeset-bot bot commented Jan 7, 2026

🦋 Changeset detected

Latest commit: 900aa10

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphql-codegen/typescript-operations Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ikusakov2 ikusakov2 marked this pull request as ready for review January 7, 2026 22:03
Comment on lines 125 to 128
const documentWithExternalFragments: DocumentNode = {
...documentNode,
definitions: [...documentNode.definitions, ...(config.externalFragments || []).map(f => f.node)],
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the functionality in the above statement used to create allFragments could be used for our fragments here somehow? 🤔
It seems to do a similar function of collecting fragments, either from documents or from config.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call!
Check the new code - I combined it with allFragments.

@@ -0,0 +1,2 @@
**/__generated__/**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel we should unignore the generation 🙂
This could be a good test that can be kept as snapshot test, and an advanced use case of codegen

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, generated files added!

@@ -0,0 +1,106 @@
#!/usr/bin/env ts-node
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created the dev-test-alpha just as a temporary package to demonstrate our company issues.
Do you think it would be worth keeping it?
Then:

  • I'll need to add some tests which would get invoked when global tests are running.
  • We need to come up with some better name than dev-test-alpha

Copy link
Collaborator

@eddeee888 eddeee888 Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think so! I find this test is very valuable, as it can be used to catch unexpected bugs, at least in the initial stage after rolling out.

I feel we might be able to simplify a few things in the setup. And worst case, if its usefulness is overshadowed by maintenance, we can decide to drop it (or further simplify) later 🙂

// @generated
// This file was automatically generated and should not be edited.

import type * as Types from '../../graphql-code-generator/dev-test-alpha/src/__generated__/globalTypes';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we already worked on removing this line in typescript-operations plugin.
But it probably comes from near-operation-file preset.
Shall we ignore it until we do the next version of near-operation-file?


type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
export enum UserManagerRoleType {
Copy link
Author

@ikusakov2 ikusakov2 Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the recent fix - it adds the enum in the correct file.

@ikusakov2 ikusakov2 closed this Jan 8, 2026
@ikusakov2 ikusakov2 deleted the feature/add-config-extractAllFieldsToTypesCompact branch January 8, 2026 23:00
@ikusakov2 ikusakov2 restored the feature/add-config-extractAllFieldsToTypesCompact branch January 8, 2026 23:02
@ikusakov2 ikusakov2 reopened this Jan 8, 2026
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

Successfully merging this pull request may close these issues.

3 participants