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
6 changes: 0 additions & 6 deletions .changeset/beige-insects-try.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/famous-rats-laugh.md

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ jobs:
name:
Unit Test on Node ${{matrix.node_version}} (${{matrix.os}}) and GraphQL
v${{matrix.graphql_version}}
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
needs:
- lint
- prettier-check
Expand All @@ -189,7 +189,7 @@ jobs:
node_version: [22, 24]
graphql_version: [15, 16, 17]
include:
- node-version: 22
- node_version: 22
os: windows-latest
graphql_version: 16
steps:
Expand Down Expand Up @@ -223,7 +223,7 @@ jobs:
name:
Watcher Unit Test on Node ${{matrix.node_version}} (${{matrix.os}}) and GraphQL
v${{matrix.graphql_version}}
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
needs:
- lint
- prettier-check
Expand All @@ -234,7 +234,7 @@ jobs:
node_version: [20]
graphql_version: [15, 16]
include:
- node-version: 20
- node_version: 20
os: windows-latest
graphql_version: 16
steps:
Expand Down
9 changes: 9 additions & 0 deletions packages/plugins/other/visitor-plugin-common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @graphql-codegen/visitor-plugin-common

## 7.2.3

### Patch Changes

- [#10904](https://github.com/dotansimha/graphql-code-generator/pull/10904)
[`2dd1531`](https://github.com/dotansimha/graphql-code-generator/commit/2dd1531475193de473cb5220926faf8715a64854)
Thanks [@eddeee888](https://github.com/eddeee888)! - Fix fragment masking generation when
conditional directive is used

## 7.2.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/other/visitor-plugin-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphql-codegen/visitor-plugin-common",
"version": "7.2.2",
"version": "7.2.3",
"type": "module",
"repository": {
"type": "git",
Expand Down
31 changes: 31 additions & 0 deletions packages/plugins/typescript/operations/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# @graphql-codegen/typescript-operations

## 6.1.5

### Patch Changes

- [#10909](https://github.com/dotansimha/graphql-code-generator/pull/10909)
[`b36c084`](https://github.com/dotansimha/graphql-code-generator/commit/b36c0843de8d5f5958f1eabee74fd72086d63953)
Thanks [@jaydenseric](https://github.com/jaydenseric)! - Added missing types and tests for the
TypeScript operations plugin option `disableDescriptions`.

## 6.1.4

### Patch Changes

- [#10910](https://github.com/dotansimha/graphql-code-generator/pull/10910)
[`1624c8a`](https://github.com/dotansimha/graphql-code-generator/commit/1624c8aae53176a21c0dbbe1fb0d7d565ba50e22)
Thanks [@eddeee888](https://github.com/eddeee888)! - Fix performance issue when
config.importSchemaTypesFrom is set, and the provided schema is still unnecessarily visited

## 6.1.3

### Patch Changes

- [#10905](https://github.com/dotansimha/graphql-code-generator/pull/10905)
[`5a9f96c`](https://github.com/dotansimha/graphql-code-generator/commit/5a9f96cde55b310976729d5fc3cc2e7aa98ace31)
Thanks [@eddeee888](https://github.com/eddeee888)! - Fix types when introspection is used and
values are not generated or imported correctly

- Updated dependencies
[[`2dd1531`](https://github.com/dotansimha/graphql-code-generator/commit/2dd1531475193de473cb5220926faf8715a64854)]:
- @graphql-codegen/visitor-plugin-common@7.2.3

## 6.1.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/typescript/operations/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphql-codegen/typescript-operations",
"version": "6.1.2",
"version": "6.1.5",
"type": "module",
"description": "GraphQL Code Generator plugin for generating TypeScript types for GraphQL queries, mutations, subscriptions and fragments",
"repository": {
Expand Down
26 changes: 26 additions & 0 deletions packages/plugins/typescript/operations/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,32 @@ export interface TypeScriptDocumentsPluginConfig extends RawDocumentsConfig {
* ```
*/
noExport?: boolean;

/**
* @description Set the value to `true` in order to disable all description generation.
* @default false
*
* @exampleMarkdown
* ## Disable description generation
* ```ts filename="codegen.ts"
* import type { CodegenConfig } from '@graphql-codegen/cli'
*
* const config: CodegenConfig = {
* // ...
* generates: {
* 'path/to/file.ts': {
* plugins: ['typescript-operations'],
* config: {
* disableDescriptions: true
* }
* }
* }
* }
* export default config
* ```
*/
disableDescriptions?: boolean;

/**
* @name addOperationExport
* @type boolean
Expand Down
12 changes: 10 additions & 2 deletions packages/plugins/typescript/operations/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,16 @@ export const plugin: PluginFunction<
// #region generateSchemaTypes
// When Input and Enum appear in Result selection sets, we need to
// generate those types so they can be referred to correctly
const schemaTypes = oldVisit(transformSchemaAST(schema, config).ast, { leave: visitor });
const schemaTypesDefinitions = findTransformedDefinitions(schemaTypes);
//
// Note: we don't run visitor on the schema when i.e. `!config.importSchemaTypesFrom`
// because the schema types are supposedly already generated elsewhere.
// In such cases, running the visitor on the schema will do unncessary work
let schemaTypesDefinitions: string[] = [];
if (!config.importSchemaTypesFrom) {
const schemaTypes = oldVisit(transformSchemaAST(schema, config).ast, { leave: visitor });
schemaTypesDefinitions = findTransformedDefinitions(schemaTypes);
}

// #endregion

// #region generateIntrospectionTypesDefinitions
Expand Down
41 changes: 41 additions & 0 deletions packages/plugins/typescript/operations/tests/ts-documents.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,47 @@ describe('TypeScript Operations Plugin', () => {
await validate(content);
});

describe('disableDescriptions', () => {
const description = 'Description.';
const testSchema = buildSchema(/* GraphQL */ `
"${description}"
enum A {
B
}

type Query {
a: A
}
`);
const document = parse(/* GraphQL */ `
query {
a
}
`);

it('Should generate descriptions when set to false', async () => {
const { content } = await plugin(
testSchema,
[{ document }],
{ disableDescriptions: false },
{ outputFile: '' },
);

expect(content).toContain(description);
});

it('Should not generate descriptions when set to true', async () => {
const { content } = await plugin(
testSchema,
[{ document }],
{ disableDescriptions: true },
{ outputFile: '' },
);

expect(content).not.toContain(description);
});
});

it('Can merge an inline fragment with a spread', async () => {
const testSchema = buildSchema(/* GraphQL */ `
interface Comment {
Expand Down
15 changes: 15 additions & 0 deletions packages/presets/client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# @graphql-codegen/client-preset

## 6.1.1

### Patch Changes

- [#10904](https://github.com/dotansimha/graphql-code-generator/pull/10904)
[`2dd1531`](https://github.com/dotansimha/graphql-code-generator/commit/2dd1531475193de473cb5220926faf8715a64854)
Thanks [@eddeee888](https://github.com/eddeee888)! - Fix fragment masking generation when
conditional directive is used

- Updated dependencies
[[`2dd1531`](https://github.com/dotansimha/graphql-code-generator/commit/2dd1531475193de473cb5220926faf8715a64854),
[`5a9f96c`](https://github.com/dotansimha/graphql-code-generator/commit/5a9f96cde55b310976729d5fc3cc2e7aa98ace31)]:
- @graphql-codegen/visitor-plugin-common@7.2.3
- @graphql-codegen/typescript-operations@6.1.3

## 6.1.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/presets/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphql-codegen/client-preset",
"version": "6.1.0",
"version": "6.1.1",
"type": "module",
"description": "GraphQL Code Generator preset for client.",
"repository": {
Expand Down
Loading