Skip to content

Commit 5da3ba2

Browse files
fix: restore documentMode 'string' default — graphql-tag not needed
Reverting the removal of documentMode: 'string'. With 'string' mode, the generic-sdk plugin uses plain string type for documents instead of DocumentNode, so graphql-tag is NOT required as a dependency. The TypedDocumentString class was never needed — that was our mistake. The generic-sdk with documentMode: 'string' + rawRequest works correctly with plain strings, no class injection needed. Without this default, codegen falls back to 'graphQLTag' mode which requires the graphql-tag package, breaking builds. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 09ddce2 commit 5da3ba2

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/core/codegen/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const DEFAULT_CLIENT_CODEGEN_CONFIG: ClientCodegenConfig = {
3333
strictScalars: true,
3434
maybeValue: 'T | null | undefined',
3535
inputMaybeValue: 'T | undefined',
36+
documentMode: 'string',
3637
pureMagicComment: true,
3738
dedupeOperationSuffix: true,
3839
rawRequest: true,

tests/unit/codegen/client-config.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ describe('dEFAULT_CLIENT_CODEGEN_CONFIG', () => {
5858
strictScalars: true,
5959
maybeValue: 'T | null | undefined',
6060
inputMaybeValue: 'T | undefined',
61+
documentMode: 'string',
6162
pureMagicComment: true,
6263
dedupeOperationSuffix: true,
6364
rawRequest: true,
@@ -83,8 +84,8 @@ describe('dEFAULT_CLIENT_CODEGEN_CONFIG', () => {
8384
expect(scalars.File).toEqual({ input: 'File', output: 'File' })
8485
})
8586

86-
it('should not set documentMode by default (uses graphql-codegen default)', () => {
87-
expect(DEFAULT_CLIENT_CODEGEN_CONFIG.documentMode).toBeUndefined()
87+
it('should use string document mode (no graphql-tag dependency needed)', () => {
88+
expect(DEFAULT_CLIENT_CODEGEN_CONFIG.documentMode).toBe('string')
8889
})
8990

9091
it('should have rawRequest enabled for SDK generation', () => {

tests/unit/codegen/client.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,8 @@ describe('dEFAULT_CLIENT_CODEGEN_CONFIG', () => {
507507
expect(DEFAULT_CLIENT_CODEGEN_CONFIG.inputMaybeValue).toBe('T | undefined')
508508
})
509509

510-
it('should not set documentMode by default (uses graphql-codegen default)', () => {
511-
expect(DEFAULT_CLIENT_CODEGEN_CONFIG.documentMode).toBeUndefined()
510+
it('should use string document mode (no graphql-tag dependency needed)', () => {
511+
expect(DEFAULT_CLIENT_CODEGEN_CONFIG.documentMode).toBe('string')
512512
})
513513

514514
it('should have pure magic comment enabled', () => {

0 commit comments

Comments
 (0)