Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/persisted-documents-string-mode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"devDependencies": {
"@graphql-typed-document-node/core": "3.2.0",
"@graphql-codegen/cli": "6.1.1",
"@graphql-codegen/cli": "6.1.2",
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.3",
"@babel/preset-typescript": "7.28.5"
Expand Down
2 changes: 1 addition & 1 deletion examples/persisted-documents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"devDependencies": {
"@graphql-typed-document-node/core": "3.2.0",
"@graphql-codegen/cli": "6.1.1",
"@graphql-codegen/cli": "6.1.2",
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.3",
"@babel/preset-typescript": "7.28.5"
Expand Down
2 changes: 1 addition & 1 deletion examples/react/apollo-client-defer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"graphql-yoga": "5.7.0"
},
"devDependencies": {
"@graphql-codegen/cli": "^6.1.1",
"@graphql-codegen/cli": "^6.1.2",
"@types/node": "^22.0.0",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.10",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/apollo-client-swc-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"devDependencies": {
"@graphql-codegen/client-preset-swc-plugin": "0.2.0",
"@graphql-codegen/cli": "^6.1.1",
"@graphql-codegen/cli": "^6.1.2",
"@vitejs/plugin-react-swc": "^3.3.0",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/apollo-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@graphql-codegen/cli": "^6.1.1",
"@graphql-codegen/cli": "^6.1.2",
"@vitejs/plugin-react": "^4.0.0",
"@types/node": "^22.0.0",
"@types/react": "^18.0.15",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/http-executor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@graphql-codegen/cli": "^6.1.1",
"@graphql-codegen/cli": "^6.1.2",
"@vitejs/plugin-react": "^4.0.0",
"@types/node": "^22.0.0",
"@types/react": "^18.0.17",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/nextjs-swr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"swr": "^2.0.0"
},
"devDependencies": {
"@graphql-codegen/cli": "^6.1.1",
"@graphql-codegen/cli": "^6.1.2",
"@graphql-codegen/schema-ast": "5.0.0",
"@graphql-codegen/client-preset-swc-plugin": "0.2.0",
"@types/node": "^22.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/tanstack-react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@graphql-codegen/cli": "^6.1.1",
"@graphql-codegen/cli": "^6.1.2",
"@vitejs/plugin-react": "^4.0.0",
"@types/node": "^22.0.0",
"@types/react": "^18.0.17",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/urql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"devDependencies": {
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.10",
"@graphql-codegen/cli": "^6.1.1",
"@graphql-codegen/cli": "^6.1.2",
"@vitejs/plugin-react": "^4.0.0",
"typescript": "5.5.4",
"serve": "14.2.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"devDependencies": {
"@graphql-codegen/cli": "6.1.1"
"@graphql-codegen/cli": "6.1.2"
},
"dependencies": {
"@graphql-typed-document-node/core": "3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript-graphql-request/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"devDependencies": {
"@graphql-codegen/cli": "6.1.1"
"@graphql-codegen/cli": "6.1.2"
},
"dependencies": {
"graphql": "16.9.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript-resolvers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"devDependencies": {
"@graphql-codegen/cli": "6.1.1",
"@graphql-codegen/cli": "6.1.2",
"@graphql-codegen/typescript": "5.0.8",
"@graphql-codegen/typescript-resolvers": "5.1.6"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/vite/vite-react-cts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"vite": "^6.0.0"
},
"devDependencies": {
"@graphql-codegen/cli": "6.1.1",
"@graphql-codegen/cli": "6.1.2",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"cypress": "15.7.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/vite/vite-react-mts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"vite": "^6.0.0"
},
"devDependencies": {
"@graphql-codegen/cli": "6.1.1",
"@graphql-codegen/cli": "6.1.2",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"cypress": "15.7.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/vite/vite-react-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"vite": "^6.0.0"
},
"devDependencies": {
"@graphql-codegen/cli": "6.1.1",
"@graphql-codegen/cli": "6.1.2",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"cypress": "15.7.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/vue/apollo-composable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"vue": "^3.2.37"
},
"devDependencies": {
"@graphql-codegen/cli": "^6.1.1",
"@graphql-codegen/cli": "^6.1.2",
"@vitejs/plugin-vue": "^5.0.0",
"typescript": "^5.0.0",
"vite": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/vue/urql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"vue": "^3.2.45"
},
"devDependencies": {
"@graphql-codegen/cli": "^6.1.1",
"@graphql-codegen/cli": "^6.1.2",
"@vitejs/plugin-vue": "^5.0.0",
"typescript": "^5.0.0",
"vite": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/vue/villus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"vue": "^3.2.37"
},
"devDependencies": {
"@graphql-codegen/cli": "^6.1.1",
"@graphql-codegen/cli": "^6.1.2",
"@vitejs/plugin-vue": "^5.0.0",
"typescript": "^5.0.0",
"vite": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/yoga-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"devDependencies": {
"@graphql-typed-document-node/core": "3.2.0",
"@graphql-codegen/cli": "6.1.1",
"@graphql-codegen/cli": "6.1.2",
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.3",
"@babel/preset-typescript": "7.28.5"
Expand Down
7 changes: 7 additions & 0 deletions packages/graphql-codegen-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @graphql-codegen/cli

## 6.1.2

### Patch Changes

- [#10590](https://github.com/dotansimha/graphql-code-generator/pull/10590) [`e173e11`](https://github.com/dotansimha/graphql-code-generator/commit/e173e113331cd279fb9dec51203d8c5a34915999) Thanks [@ya2s](https://github.com/ya2s)! - Fix GraphQL Config loading to forward nested `extensions.codegen.config` options
when loading schemas/documents, matching `codegen.ts` behavior.

## 6.1.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-codegen-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphql-codegen/cli",
"version": "6.1.1",
"version": "6.1.2",
"license": "MIT",
"bin": {
"gql-gen": "dist/cjs/bin.js",
Expand Down
8 changes: 6 additions & 2 deletions packages/graphql-codegen-cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,9 @@ export class CodegenContext {
if (this._graphqlConfig) {
// TODO: SchemaWithLoader won't work here
return addHashToSchema(
this._graphqlConfig.getProject(this._project).loadSchema(pointer, 'GraphQLSchema', config)
this._graphqlConfig
.getProject(this._project)
.loadSchema(pointer, 'GraphQLSchema', { ...config, ...config.config })
);
}
return addHashToSchema(loadSchema(pointer, config));
Expand All @@ -454,7 +456,9 @@ export class CodegenContext {
const config = this.getConfig(defaultDocumentsLoadOptions);
if (this._graphqlConfig) {
// TODO: pointer won't work here
return addHashToDocumentFiles(this._graphqlConfig.getProject(this._project).loadDocuments(pointer, config));
return addHashToDocumentFiles(
this._graphqlConfig.getProject(this._project).loadDocuments(pointer, { ...config, ...config.config })
);
}

return addHashToDocumentFiles(loadDocuments(pointer, config));
Expand Down
35 changes: 34 additions & 1 deletion packages/graphql-codegen-cli/tests/config.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createContext, ensureContext } from '../src/index.js';
import { buildSchema } from 'graphql';
import { createContext, ensureContext, CodegenContext } from '../src/index.js';

describe('Codegen config - Context', () => {
it('loads and merge multiple schemas when using GraphQL config', async () => {
Expand Down Expand Up @@ -86,4 +87,36 @@ describe('Codegen config - Context', () => {
expect(typeMap['DateTime']).toBeDefined();
expect(typeMap['User']).toBeDefined();
});

it('passes nested config values to graphql-config schema loader', async () => {
const loadSchemaSpy = vi.fn().mockResolvedValue(buildSchema('type Query { _: Boolean }'));
const project = {
extension: vi.fn().mockReturnValue({
generates: {},
config: {
inputValueDeprecation: true,
},
}),
schema: ['http://example.com/graphql'],
documents: [],
loadSchema: loadSchemaSpy,
loadDocuments: vi.fn(),
};
const graphqlConfig = {
filepath: '/tmp/graphql.config.ts',
dirpath: '/tmp',
getProject: vi.fn().mockReturnValue(project),
} as any;

const context = new CodegenContext({ graphqlConfig });
await context.loadSchema(['http://example.com/graphql']);

expect(loadSchemaSpy).toHaveBeenCalledWith(
['http://example.com/graphql'],
'GraphQLSchema',
expect.objectContaining({
inputValueDeprecation: true,
})
);
});
});
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@graphql-codegen/add": "6.0.0",
"@graphql-codegen/c-sharp": "4.3.1",
"@graphql-codegen/c-sharp-operations": "2.3.1",
"@graphql-codegen/cli": "6.1.1",
"@graphql-codegen/cli": "6.1.2",
"@graphql-codegen/client-preset": "5.2.3",
"@graphql-codegen/core": "5.0.0",
"@graphql-codegen/flow": "2.3.6",
Expand Down
Loading