On this page

@graphql-codegen/visitor-plugin-common

Changelog for @graphql-codegen/visitor-plugin-common: every release with its changes and the pull requests behind them.

7.3.0

Minor Changes

  • #11011 b3fbb13 Thanks @eddeee888! - Add documentMode: 'plainString'. Documents are generated as plain template strings with fragments embedded, instead of TypedDocumentString instances. No class, import or type cast is generated, so each document is typed as string.

7.2.10

Patch Changes

  • #10985 d8aa07f Thanks @eddeee888! - Build with strict: true, which changes these emitted type declarations:

    • @graphql-codegen/cli: mkdirp returns Promise<string | undefined>, and the require (-r) CLI option’s default is typed never[] instead of any[].
    • @graphql-codegen/visitor-plugin-common: BaseResolversVisitor and BaseTypesVisitor SchemaDefinition()/SchemaExtension() return null instead of any.
    • @graphql-codegen/visitor-plugin-common: BaseSelectionSetProcessor.typeCache is keyed by Location | undefined.
    • @graphql-codegen/visitor-plugin-common: SelectionSetToObject.buildSelectionSet returns typeInfo as { name: string; type: string } | null.
    • @graphql-codegen/visitor-plugin-common: getPossibleTypes accepts null as the type, which graphql 15’s schema.getType() can return.
    • @graphql-codegen/visitor-plugin-common: removeDescription returns nodes with description: undefined instead of any.
    • @graphql-codegen/typescript: TsIntrospectionVisitor’s constructor takes pluginConfig as TypeScriptPluginConfig | undefined, DirectiveDefinition() returns null and ObjectTypeDefinition() returns string | null.
    • @graphql-codegen/client-preset: the babel preset accepts options as ClientBabelPresetOptions | null | undefined.
    • @graphql-codegen/testing: mockGraphQLServer returns nock.Scope | null.
    • @graphql-codegen/graphql-modules-preset: a schema without extensions (graphql 15) throws the “requires to use GraphQL SDL” error instead of a TypeError.

    Generated output is unchanged.

  • #11039 5078faf Thanks @eddeee888! - Fix type errors in visitor-plugin-common (utils, imports, naming, mappers, types, variables-to-object, convert-schema-enum-to-declaration-block-string, selection-set-processor/base and optimize-operations) under strict: true:

    • transformComment accepts undefined and null, which it already handles by returning an empty string.
    • block declares its param as string[] | null | undefined, which it already handles by returning an empty string.
    • DeclarationBlock’s fields are typed as string | null (_name as string | NameNode | null), and withBlock accepts null, which renders the same as no block.
    • DeclarationBlock falls back to returning the block unchanged when blockTransformer is passed as undefined, instead of throwing.
    • buildScalars accepts an undefined scalars mapping, which it already handles by using only the defaults and the schema.
    • buildTypeImport accepts a nullish identifier and source, and throws a descriptive error when either is missing.
    • ParsedEnumValuesMap’s mappedValues, sourceIdentifier, sourceFile and importIdentifier accept null, which parseEnumValues already emits.
    • transformMappers defaults rawMappers to {}.
    • OperationVariablesToObject.getName, OperationVariablesToObject.transform and BaseSelectionSetProcessor.buildSelectionSetFromStrings may return null, which they already return.
    • buildEnumValuesBlock throws a descriptive error when an enum value is not defined on the schema’s enum.
    • optimizeOperations throws a descriptive error when a document file has no parsed document.
    • unique’s default key uses String(item).
    • convertSchemaEnumToDeclarationBlockString treats an enum node without values as empty instead of throwing.
    • generateFragmentImportStatement treats a missing identifiers as empty.
    • getDeprecationReason returns the default reason for a @deprecated directive without arguments.
    • isOneOfInputObjectType returns false instead of undefined.
    • buildEnumValuesBlock treats a non-enum schema type with the enum’s name as having no schema enum.
    • OperationVariablesToObject emits '' instead of the text undefined/null when a variable has no name or no type identifier.

    Generated output is unchanged, except in the cases above.

7.2.9

Patch Changes

  • #11043 31761f9 Thanks @eddeee888! - dependencies updates:

  • #11043 31761f9 Thanks @eddeee888! - Update @graphql-tools/utils to v12, and other @graphql-tools/* dependencies and graphql-config to releases that use it, to pick up the fix for GHSA-7mx3-vvmw-hjmv (prototype pollution in mergeDeep, @graphql-tools/utils <= 12.0.0).

    @graphql-codegen/cli now unwraps the AggregateError that newer @graphql-tools/load versions throw, so schema and document syntax errors still print the native GraphQLError with its file location.

  • #11037 463e6ef Thanks @eddeee888! - Fix type errors in visitor-plugin-common (base-types-visitor) under strict: true:

    • BaseTypesVisitor’s constructor takes additionalConfig as Partial<TPluginConfig>, since the visitor fills in the defaults for every key it leaves out.
    • BaseTypesVisitor handles input objects, objects, interfaces, unions and enums without fields, types, values or description by treating them as empty, instead of throwing.

    Generated output is unchanged.

  • Updated dependencies [31761f9, 31761f9]:

    • @graphql-codegen/plugin-helpers@7.4.2

7.2.8

Patch Changes

  • #11009 1f7566f Thanks @eddeee888! - Fix type errors in typescript-operations under strict: true by widening the shared types it calls into:

    • @graphql-codegen/plugin-helpers: Types.ComplexPluginOutput’s prepend and append now accept null items. Core already skipped them.
    • @graphql-codegen/visitor-plugin-common: DeclarationBlock.withComment accepts undefined, parseEnumValues’s mapOrStr is optional (it already defaulted to {}), ImportSource.namespace accepts null, and optimizeOperations’s includeFragments is optional.
    • @graphql-codegen/typescript-operations: skips document files without a document, and no longer throws when called without the plugin info argument.

    Generated output is unchanged.

  • #11014 7a376ef Thanks @eddeee888! - Fix type errors in typescript under strict: true by typing the shared visitor methods it overrides:

    • @graphql-codegen/visitor-plugin-common: adds NormalizedDeclarationKindConfig (every declaration kind set), used by normalizeDeclarationKind, DEFAULT_DECLARATION_KINDS and ParsedTypesConfig.declarationKind. BaseTypesVisitor’s NamedType, ListType, FieldDefinition, InputValueDefinition and UnionTypeDefinition have typed visitor params (key and parent are required, since the visitor always passes them), and ObjectTypeDefinition, EnumTypeDefinition and DirectiveDefinition may return null.
    • @graphql-codegen/typescript: skips document files without a document when collecting introspection types, types the TsVisitor visitor params, and TsVisitor.EnumTypeDefinition may return null like the introspection visitor’s override.

    Generated output is unchanged.

  • #11031 3caccd3 Thanks @eddeee888! - Fix type errors in visitor-plugin-common (selection-set-to-object, client-side-base-visitor and base-documents-visitor) under strict: true:

    • BaseDocumentsVisitor._selectionSetToObject is optional, since it is only set by setSelectionSetHandler. FragmentDefinition and OperationDefinition throw a descriptive error when it is not set, and FragmentDefinition throws one when the fragment’s type condition is not in the schema.
    • BaseDocumentsVisitor.FragmentDefinition may return null, which it already returns when generateOperationTypes is false.
    • ClientSideBaseVisitor.buildOperation may return null, which its base implementation already returns.
    • SelectionSetToObject.transformSelectionSet declares its return type, and throws a descriptive error when the instance has no selection set.
    • LinkField’s alias is optional, matching the link fields built for fields without an alias.
    • BaseSelectionSetProcessor.typeCache is keyed by Location | undefined, since selection sets parsed with noLocation have no loc.
    • getPossibleTypes accepts any GraphQLType or undefined, which it already handles by unwrapping lists and non-nulls and returning no types, and returns a copy of the schema’s possible types instead of the schema’s own readonly array.
    • OperationVariablesToObject.transform accepts undefined, which it already handles by returning null.

    Generated output is unchanged.

  • #11030 ccc0d5c Thanks @eddeee888! - Fix type errors in visitor-plugin-common (base-resolvers-visitor) under strict: true:

    • BaseResolversVisitor’s constructor takes additionalConfig as Partial<TPluginConfig>, since the visitor fills in the defaults for every key it leaves out.
    • BaseResolversVisitor’s ScalarTypeDefinition, DirectiveDefinition and EnumTypeDefinition may return null, which they already return for skipped federation scalars and directives and for enums without mappers or enumValues.
    • BaseResolversVisitor.getAbstractMembersType’s isTypenameNonOptional is optional, matching the optional resolversNonOptionalTypename flags it is read from.
    • BaseResolversVisitor.defaultMapperType throws a descriptive error when the defaultMapper config is not set.

    Generated output is unchanged.

  • Updated dependencies [43d0f65, 82ebbb5, eae0e62, 1f7566f]:

    • @graphql-codegen/plugin-helpers@7.4.1

7.2.7

Patch Changes

  • #11001 65e5599 Thanks @eddeee888! - Fix typescript-operations generating invalid interface declarations for @oneOf inputs when declarationKind is interface (#10996).

    A @oneOf input with multiple fields is a union, so it is always generated as a type alias; a single-field @oneOf input keeps the configured declarationKind.input. typescript and typescript-operations share this rule through the new getOneOfInputDeclarationKind export from @graphql-codegen/visitor-plugin-common.

7.2.6

Patch Changes

  • #10982 e5361bc Thanks @eddeee888! - Fix out-of-memory errors with deeply nested, widely reused fragments (#10940).

    The type cache used while generating selection set types was keyed by every fragment-expanded field path, so its keys grew exponentially with fragment nesting. Keys are now built from the selection set as written, referencing fragment spreads by name, so they stay linear in the size of the documents. The exported getFieldNames helper from @graphql-codegen/visitor-plugin-common, which built those expanded paths, is removed.

  • #10993 be69e9d Thanks @eddeee888! - Type getConfigValue’s value parameter as T | null | undefined, so the result is non-nullable when a non-nullable default is given.

  • Updated dependencies [1d1153b]:

    • @graphql-codegen/plugin-helpers@7.4.0

7.2.5

Patch Changes

7.2.4

Patch Changes

  • #10916 d95d378 Thanks @eddeee888! - Revert Partial handling when conditional fragment and fragment masking are used

    This is causing all masked fields to be optional due to how function type override works.

7.2.3

Patch Changes

7.2.2

Patch Changes

  • #10882 206a409 Thanks @wassim-k! - Avoid emitting an empty import statement (import '...';) when an import source has no identifiers and no namespace.

  • #10899 e7a1451 Thanks @eddeee888! - Fix conditional directive (@skip and @include) incorrectly drop fields in Result when used on Inline Fragment / Fragment Spread

7.2.1

Patch Changes

  • #10897 bd689bb Thanks @eddeee888! - Fix issues when extractAllFieldsToTypes=true and @defer are used, then duplicate types may be generated

7.2.0

Minor Changes

Patch Changes

  • Updated dependencies [959915f]:
    • @graphql-codegen/plugin-helpers@7.1.0

7.1.2

Patch Changes

  • #10839 8a65a1b Thanks @vkbansal-rubrik! - handles conditional spread of a fragment whose top-level selections are fragment spreads or contain inline fragments

7.1.1

Patch Changes

7.1.0

Minor Changes

  • #10863 8707247 Thanks @eddeee888! - Create typedDocumentString to support TypedDocumentString usage (common in Client-side plugins when documentMode=string)

7.0.4

Patch Changes

7.0.3

Patch Changes

7.0.2

Patch Changes

  • #10777 a6a6786 Thanks @ikusakov2! - skip conditional selection separation when extractAllFieldsToTypesCompact is enabled

7.0.1

Patch Changes

7.0.0

Major Changes

  • #10496 afaace6 Thanks @eddeee888! - Fix nullable field optionality in operations

    Previously, a nullable Result field is generated as optional (marked by ? TypeScript modifier) by default. This is not correct, because generally at runtime such field can only be null, and not undefined (both missing from the object OR undefined). The only exceptions are when fields are deferred (using @defer directive) or marked as conditional (using @skip or @include).

    Now, a nullable Result field cannot be optional unless the exceptions are met. This also limits avoidOptionals to only target Variables input, since some users may want to force explicit null when providing operation variables.

  • #10496 afaace6 Thanks @eddeee888! - BREAKING CHANGE: visitors’ config option are moved based on their use case

    • addTypename/skipTypename: is only a types-visitor concern. This is moved to types-visitor from base-visitor
    • nonOptionalTypename: is a documents-visitor and types-visitor concern. Moved from base-visitor there
    • extractAllFieldsToTypes: is a documents-visitor concern. Moved from base-visitor there
    • enumPrefix and enumSuffix: need to be in base-visitor as all 3 types of visitors need this to correctly sync the enum type names. This is moved to base visitor
    • ignoreEnumValuesFromSchema: is a documents-visitor and types-visitor concern. Moved from base-visitor there.
    • globalNamespace: is a documents-visitor concern. Moved from base-visitor there

    Refactors

    • documents-visitor no longer extends types-visitor option types as they have two distinct usages now. The types now extend base-visitor types. This is now consistent with documents-visitor extending base-visitor
    • Classes now handle config parsing and types at the same level e.g. if typescript-operations plugin parses configOne, then the types for configOne must be in that class, rather than in base-documents-visitor

    Note: These visitors are rolled up into one type for simplicity

    • base-visitor: includes base-visitor
    • documents-visitor: includes base-documents-visitor and typescript-operations visitor
    • types-visitor: includes base-types-visitor and typescript visitor
    • resolvers-visitor: includes base-resolvers-visitor and typescript-resolvers visitor
  • #10496 afaace6 Thanks @eddeee888! - BREAKING CHANGE: make unknown instead of any the default custom scalar type

  • #10496 afaace6 Thanks @eddeee888! - BREAKING CHANGE: Update deps to latest, some only support ESM

    Node 20 support is dropped in this release. Node 22 comes with require() support for ESM, which means it’s easier to integrate ES modules into applications. Therefore, it is safe to start using ESM-only packages.

    If you are a user, please upgrade to Node 22. If you are a lib maintainer and see ESM vs CJS issues when running Jest tests, try using Vitest.

  • #10496 afaace6 Thanks @eddeee888! - BREAKING CHANGE: Drop Node 20 support

  • #10496 afaace6 Thanks @eddeee888! - BREAKING CHANGE: @graphql-codegen/visitor-plugin-common’s base-types-visitor no longer has getNodeComment or buildEnumValuesBlock method.

  • #10496 afaace6 Thanks @eddeee888! - BREAKING CHANGE: Operation plugin and Client Preset no longer generates optional __typename for result type

    __typenam should not be in the request unless:

    • explicitly requested by the user
    • automatically injected into the request by clients, such as Apollo Clients.

    Note: Apollo Client users can still use nonOptionalTypename: true and skipTypeNameForRoot: true to ensure generated types match the runtime behaviour.

  • #10496 afaace6 Thanks @eddeee888! - BREAKING CHANGE: Remove unused utility types from typescript plugin as they were previously used for typescript-operations plugin:

    • MakeOptional
    • MakeMaybe
    • MakeEmpty
    • Incremental

    BREAKING CHANGE: Remove getRootTypeNames function because it’s available in @graphql-utils/tools and not used anywhere

Minor Changes

  • #10496 afaace6 Thanks @eddeee888! - Add support for declarationKind for typescript-operations

    • Input: can only be type or interface
    • Variables: no support. It must always be type because it’s an alias e.g. Variables = Exact<{ something: type }>
    • Result: can only be type or interface
      • Note: when extractAllFieldsToTypes:true or extractAllFieldsToTypesCompact:true, Results are used as type alias, so they are forced to be type. There is a console warning for users.
  • #10496 afaace6 Thanks @eddeee888! - Add importSchemaTypesFrom support

  • #10496 afaace6 Thanks @eddeee888! - Adding config option extractAllFieldsToTypesCompact, which renders nested types names with field names only (without types)

  • #10496 afaace6 Thanks @eddeee888! - Add generateOperationTypes to typescript-operations to allow omitting operation types such as Variables, Query/Mutation/Subscription selection set, and Fragment types

  • #10496 afaace6 Thanks @eddeee888! - Fixing 2 bugs: 1) including enums from external fragments; 2) extractAllFieldsToTypesCompact does not create duplicates

Patch Changes

6.3.0

Minor Changes

  • #10659 e65d303 Thanks @ikusakov2! - Add support for externalDocuments

    externalDocuments declares GraphQL documents that will be read but will not have type files generated for them. These documents are available to plugins for type resolution (e.g. fragment types), but no output files will be generated based on them. Accepts the same formats as documents.

    This config option is useful for monorepos where each project may want to generate types for its own documents, but some may need to read shared fragments from across projects.

Patch Changes

6.2.4

Patch Changes

6.2.3

Patch Changes

6.2.2

Patch Changes

6.2.1

Patch Changes

6.2.0

Minor Changes

Patch Changes

  • #10512 f821e8a Thanks @realies! - fix: allow mappers to override root types (Query, Mutation, Subscription)

    Previously, mappers configured for root types were ignored because root types were checked before mappers. This fix moves the mapper check before the root type check, allowing mappers to override rootValueType when configured.

  • Updated dependencies [9e70bcb]:

    • @graphql-codegen/plugin-helpers@6.1.0

6.1.2

Patch Changes

6.1.1

Patch Changes

  • #10498 6715330 Thanks @ardatan! - Handle schema extension nodes correctly

    When a schema doesn’t have an operation type defined but has schema extension definitions with directives like below, schema extensions are not converted to schema definitions by GraphQL Tools. So the visitor should handle schema extension nodes correctly.

    Follow-up to https://github.com/ardatan/graphql-tools/pull/7679

    extend schema @link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key"])
    
    type Foo {
      id: ID! @key
      name: String
    }

6.1.0

Minor Changes

  • #10449 8258f1f Thanks @eddeee888! - Add addInterfaceFieldResolverTypes option to support custom Interface resolver inheritance

6.0.1

Patch Changes

  • #10412 accdab6 Thanks @thekevinbrown! - Add special handling for identifiers that consist entirely of _ characters when transformUnderscore is true. This prevents _ values in GraphQL enums from being emitted without identifers in the resulting types.

6.0.0

Major Changes

  • #10218 140298a Thanks @eddeee888! - BREAKING CHANGES: Do not generate __isTypeOf for non-implementing types or non-union members

  • #10218 140298a Thanks @eddeee888! - Remove deprecated config option dedupeFragments

  • #10218 140298a Thanks @eddeee888! - Remove NameNode override

  • #10218 140298a Thanks @eddeee888! - BREAKING CHANGE: Use Record<PropertyKey, never> instead of {} for empty object type

  • #10218 140298a Thanks @eddeee888! - Ensure Federation Interfaces have __resolveReference if they are resolvable entities

    BREAKING CHANGES: Deprecate onlyResolveTypeForInterfaces because majority of use cases cannot implement resolvers in Interfaces. BREAKING CHANGES: Deprecate generateInternalResolversIfNeeded.__resolveReference because types do not have __resolveReference if they are not Federation entities or are not resolvable. Users should not have to manually set this option. This option was put in to wait for this major version.

  • #10218 140298a Thanks @eddeee888! - BREAKING CHANGE: Improve Federation Entity’s resolvers’ parent param type: These types were using reference types inline. This makes it hard to handle mappers. The Parent type now all comes from ParentResolverTypes to make handling mappers and parent types simpler.

  • #10218 140298a Thanks @eddeee888! - Bump dependencies major versions:

    • dependency-graph to v1
  • #10218 140298a Thanks @eddeee888! - Fix mappers usage with Federation

    mappers was previously used as __resolveReference’s first param (usually called “reference”). However, this is incorrect because reference interface comes directly from @key and @requires directives. This patch fixes the issue by creating a new FederationTypes type and use it as the base for federation entity types when being used to type entity references.

    BREAKING CHANGES: No longer generate UnwrappedObject utility type, as this was used to support the wrong previously generated type.

  • #10218 140298a Thanks @eddeee888! - Drop Node 18 support

Minor Changes

Patch Changes

5.8.0

Minor Changes

5.7.1

Patch Changes

5.7.0

Minor Changes

5.6.1

Patch Changes

  • #10230 60dd72f Thanks @eddeee888! - Fix generateInternalResolversIfNeeded.__resolveReference making the resolver required

    __resolveReference’s default behaviour when not declared is to pass the ref to subsequent resolvers i.e. becoming the parent. So, it means we don’t have to make this resolver required.

    This patch makes __resolveReference optional when generateInternalResolversIfNeeded.__resolveReference is set to true.

5.6.0

Minor Changes

Patch Changes

5.5.0

Minor Changes

  • #9989 55a1e9e Thanks @eddeee888! - Add generateInternalResolversIfNeeded option

    This option can be used to generate more correct types for internal resolvers. For example, only generate __resolveReference if the federation object has a resolvable @key.

    In the future, this option can be extended to support other internal resolvers e.g. __isTypeOf is only generated for implementing types and union members.

  • #10141 a235051 Thanks @eddeee888! - Add avoidCheckingAbstractTypesRecursively to avoid checking and generating abstract types recursively

    For users that already sets recursive default mappers e.g. Partial<{T}> or DeepPartial<{T}>, having both options on will cause a nested loop which eventually crashes Codegen. In such case, setting avoidCheckingAbstractTypesRecursively: true allows users to continue to use recursive default mappers as before.

Patch Changes

  • Updated dependencies [55a1e9e]:
    • @graphql-codegen/plugin-helpers@5.1.0

5.4.0

Minor Changes

  • #10077 3f4f546 Thanks @eddeee888! - Extend config.avoidOptions to support query, mutation and subscription

    Previously, config.avoidOptions.resolvers was being used to make query, mutation and subscription fields non-optional. Now, config.avoidOptions.query, config.avoidOptions.mutation and config.avoidOptions.subscription can be used to target the respective types.

5.3.1

Patch Changes

  • #10014 79fee3c Thanks @eddeee888! - Fix object types with fields being abstract types not pointing to resolver types correctly

5.3.0

Minor Changes

Patch Changes

  • #10019 14ce39e Thanks @vhfmag! - Improve code generation performance by computing ClientSideBaseVisitor’s fragmentsGraph once at instantiation time.

5.2.0

Minor Changes

  • #9961 dfc5310 Thanks @eddeee888! - Update typescript-resolvers to report generated resolver types in the run to meta field in the output

Patch Changes

  • #9944 156cc2b Thanks @eddeee888! - Add _ prefix to generated RefType in ResolversInterfaceTypes and ResolversUnionTypes as it is sometimes unused

  • #9962 b49457b Thanks @eddeee888! - Fix interface mappers not working in nested/self-referencing scenarios

  • Updated dependencies [dfc5310]:

    • @graphql-codegen/plugin-helpers@5.0.4

5.1.0

Minor Changes

Patch Changes

5.0.0

Major Changes

4.1.2

Patch Changes

4.1.1

Patch Changes

4.1.0

Minor Changes

  • #9811 d8364e045 Thanks @saihaj! - fix: out-of-memory crash (fixes #7720) perf: implement a caching mechanism that makes sure the type originating at the same location is never generated twice, as long as the combination of selected fields and possible types matches feat: implement extractAllFieldsToTypes: boolean feat: implement printFieldsOnNewLines: boolean

Patch Changes

4.0.1

Patch Changes

  • #9497 2276708d0 Thanks @eddeee888! - Revert default ID scalar input type to string

    We changed the ID Scalar input type from string to string | number in the latest major version of typescript plugin. This causes issues for server plugins (e.g. typescript-resolvers) that depends on typescript plugin. This is because the scalar type needs to be manually inverted on setup which is confusing.

4.0.0

Major Changes

  • #9375 ba84a3a27 Thanks @eddeee888! - Implement Scalars with input/output types

    In GraphQL, Scalar types can be different for client and server. For example, given the native GraphQL ID:

    • A client may send string or number in the input
    • A client receives string in its selection set (i.e output)
    • A server receives string in the resolver (GraphQL parses string or number received from the client to string)
    • A server may return string or number (GraphQL serializes the value to string before sending it to the client )

    Currently, we represent every Scalar with only one type. This is what codegen generates as base type:

    export type Scalars = {
      ID: string
    }

    Then, this is used in both input and output type e.g.

    export type Book = {
      __typename?: 'Book'
      id: Scalars['ID'] // Output's ID can be `string` 👍
    }
    
    export type QueryBookArgs = {
      id: Scalars['ID'] // Input's ID can be `string` or `number`. However, the type is only `string` here 👎
    }

    This PR extends each Scalar to have input and output:

    export type Scalars = {
      ID: {
        input: string | number
        output: string
      }
    }

    Then, each input/output GraphQL type can correctly refer to the correct input/output scalar type:

    export type Book = {
      __typename?: 'Book'
      id: Scalars['ID']['output'] // Output's ID can be `string` 👍
    }
    
    export type QueryBookArgs = {
      id: Scalars['ID']['input'] // Input's ID can be `string` or `number` 👍
    }

    Note that for typescript-resolvers, the type of ID needs to be inverted. However, the referenced types in GraphQL input/output types should still work correctly:

    export type Scalars = {
      ID: {
        input: string;
        output: string | number;
      }
    }
    
    export type Book = {
      __typename?: "Book";
      id: Scalars["ID"]['output']; // Resolvers can return `string` or `number` in ID fields 👍
    };
    
    export type QueryBookArgs = {
      id: Scalars["ID"]['input']; // Resolvers receive `string` in ID fields 👍
    };
    
    export type ResolversTypes = {
      ID: ID: ResolverTypeWrapper<Scalars['ID']['output']>; // Resolvers can return `string` or `number` in ID fields 👍
    }
    
    export type ResolversParentTypes = {
      ID: Scalars['ID']['output']; // Resolvers receive `string` or `number` from parents 👍
    };

    Config changes:

    1. Scalars option can now take input/output types:
    config: {
      scalars: {
        ID: {
          input: 'string',
          output: 'string | number'
        }
      }
    }
    1. If a string is given (instead of an object with input/output fields), it will be used as both input and output types:
    config: {
      scalars: {
        ID: 'string' // This means `string` will be used for both ID's input and output types
      }
    }
    1. BREAKING CHANGE: External module Scalar types need to be an object with input/output fields
    config: {
      scalars: {
        ID: './path/to/scalar-module'
      }
    }

    If correctly, wired up, the following will be generated:

    // Previously, imported `ID` type can be a primitive type, now it must be an object with input/output fields
    import { ID } from './path/to/scalar-module'
    
    export type Scalars = {
      ID: { input: ID['input']; output: ID['output'] }
    }

    BREAKING CHANGE: This changes Scalar types which could be referenced in other plugins. If you are a plugin maintainer and reference Scalar, please update your plugin to use the correct input/output types.

  • bb66c2a31 Thanks @n1ru4l! - Require Node.js >= 16. Drop support for Node.js 14

Minor Changes

  • #9196 3848a2b73 Thanks @beerose! - Add @defer directive support

    When a query includes a deferred fragment field, the server will return a partial response with the non-deferred fields first, followed by the remaining fields once they have been resolved.

    Once start using the @defer directive in your queries, the generated code will automatically include support for the directive.

    // src/index.tsx
    import { graphql } from './gql'
    
    const OrdersFragment = graphql(`
      fragment OrdersFragment on User {
        orders {
          id
          total
        }
      }
    `)
    const GetUserQuery = graphql(`
      query GetUser($id: ID!) {
        user(id: $id) {
          id
          name
          ...OrdersFragment @defer
        }
      }
    `)

    The generated type for GetUserQuery will have information that the fragment is incremental, meaning it may not be available right away.

    // gql/graphql.ts
    export type GetUserQuery = { __typename?: 'Query'; id: string; name: string } & ({
      __typename?: 'Query'
    } & {
      ' $fragmentRefs'?: { OrdersFragment: Incremental<OrdersFragment> }
    })

    Apart from generating code that includes support for the @defer directive, the Codegen also exports a utility function called isFragmentReady. You can use it to conditionally render components based on whether the data for a deferred fragment is available:

    const OrdersList = (props: { data: FragmentType<typeof OrdersFragment> }) => {
      const data = useFragment(OrdersFragment, props.data);
      return (
        // render orders list
      )
    };
    
    function App() {
      const { data } = useQuery(GetUserQuery);
      return (
        {data && (
          <>
            {isFragmentReady(GetUserQuery, OrdersFragment, data)
    					&& <OrdersList data={data} />}
          </>
        )}
      );
    }
    export default App;
  • #9339 50471e651 Thanks @AaronMoat! - Add excludeTypes config to resolversNonOptionalTypename

    This disables the adding of __typename in resolver types for any specified typename. This could be useful e.g. if you’re wanting to enable this for all new types going forward but not do a big migration.

    Usage example:

    const config: CodegenConfig = {
      schema: 'src/schema/**/*.graphql',
      generates: {
        'src/schema/types.ts': {
          plugins: ['typescript', 'typescript-resolvers'],
          config: {
            resolversNonOptionalTypename: {
              unionMember: true,
              excludeTypes: ['MyType']
            }
          }
        }
      }
    }
  • #9229 5aa95aa96 Thanks @eddeee888! - Use generic to simplify ResolversUnionTypes

    This follows the ResolversInterfaceTypes’s approach where the RefType generic is used to refer back to ResolversTypes or ResolversParentTypes in cases of nested Union types

  • #9304 e1dc75f3c Thanks @esfomeado! - Added support for disabling suffixes on Enums.

  • #9229 5aa95aa96 Thanks @eddeee888! - Extract interfaces to ResolversInterfaceTypes and add to resolversNonOptionalTypename

    1. ResolversInterfaceTypes is a new type that keeps track of a GraphQL interface and its implementing types.

    For example, consider this schema:

    extend type Query {
      character(id: ID!): CharacterNode
    }
    
    interface CharacterNode {
      id: ID!
    }
    
    type Wizard implements CharacterNode {
      id: ID!
      screenName: String!
      spells: [String!]!
    }
    
    type Fighter implements CharacterNode {
      id: ID!
      screenName: String!
      powerLevel: Int!
    }

    The generated types will look like this:

    export type ResolversInterfaceTypes<RefType extends Record<string, unknown>> = {
      CharacterNode: Fighter | Wizard
    }
    
    export type ResolversTypes = {
      // other types...
      CharacterNode: ResolverTypeWrapper<ResolversInterfaceTypes<ResolversTypes>['CharacterNode']>
      Fighter: ResolverTypeWrapper<Fighter>
      Wizard: ResolverTypeWrapper<Wizard>
      // other types...
    }
    
    export type ResolversParentTypes = {
      // other types...
      CharacterNode: ResolversInterfaceTypes<ResolversParentTypes>['CharacterNode']
      Fighter: Fighter
      Wizard: Wizard
      // other types...
    }

    The RefType generic is used to reference back to ResolversTypes and ResolversParentTypes in some cases such as field returning a Union. 2. resolversNonOptionalTypename also affects ResolversInterfaceTypes

    Using the schema above, if we use resolversNonOptionalTypename option:

    const config: CodegenConfig = {
      schema: 'src/schema/**/*.graphql',
      generates: {
        'src/schema/types.ts': {
          plugins: ['typescript', 'typescript-resolvers'],
          config: {
            resolversNonOptionalTypename: true // Or `resolversNonOptionalTypename: { interfaceImplementingType: true }`
          }
        }
      }
    }

    Then, the generated type looks like this:

    export type ResolversInterfaceTypes<RefType extends Record<string, unknown>> = {
      CharacterNode: (Fighter & { __typename: 'Fighter' }) | (Wizard & { __typename: 'Wizard' })
    }
    
    export type ResolversTypes = {
      // other types...
      CharacterNode: ResolverTypeWrapper<ResolversInterfaceTypes<ResolversTypes>['CharacterNode']>
      Fighter: ResolverTypeWrapper<Fighter>
      Wizard: ResolverTypeWrapper<Wizard>
      // other types...
    }
    
    export type ResolversParentTypes = {
      // other types...
      CharacterNode: ResolversInterfaceTypes<ResolversParentTypes>['CharacterNode']
      Fighter: Fighter
      Wizard: Wizard
      // other types...
    }

Patch Changes

3.1.1

Patch Changes

3.1.0

Minor Changes

  • #9146 9f4d9c5a4 Thanks @eddeee888! - [typescript-resolvers] Add resolversNonOptionalTypename config option.

    This is extending on ResolversUnionTypes implemented in https://github.com/dotansimha/graphql-code-generator/pull/9069

    resolversNonOptionalTypename adds non-optional __typename to union members of ResolversUnionTypes, without affecting the union members’ base intefaces.

    A common use case for non-optional __typename of union members is using it as the common field to work out the final schema type. This makes implementing the union’s __resolveType very simple as we can use __typename to decide which union member the resolved object is. Without this, we have to check the existence of field/s on the incoming object which could be verbose.

    For example, consider this schema:

    type Query {
      book(id: ID!): BookPayload!
    }
    
    type Book {
      id: ID!
      isbn: String!
    }
    
    type BookResult {
      node: Book
    }
    
    type PayloadError {
      message: String!
    }
    
    union BookPayload = BookResult | PayloadError

    With optional __typename: We need to check existence of certain fields to resolve type in the union resolver:

    // Query/book.ts
    export const book = async () => {
      try {
        const book = await fetchBook()
        // 1. No `__typename` in resolver results...
        return {
          node: book
        }
      } catch (e) {
        return {
          message: 'Failed to fetch book'
        }
      }
    }
    
    // BookPayload.ts
    export const BookPayload = {
      __resolveType: parent => {
        // 2. ... means more checks in `__resolveType`
        if ('message' in parent) {
          return 'PayloadError'
        }
        return 'BookResult'
      }
    }

    With non-optional __typename: Resolvers declare the type. This which gives us better TypeScript support in resolvers and simplify __resolveType implementation:

    // Query/book.ts
    export const book = async () => {
      try {
        const book = await fetchBook()
        // 1. `__typename` is declared in resolver results...
        return {
          __typename: 'BookResult', // 1a. this also types `node` for us 🎉
          node: book
        }
      } catch (e) {
        return {
          __typename: 'PayloadError',
          message: 'Failed to fetch book'
        }
      }
    }
    
    // BookPayload.ts
    export const BookPayload = {
      __resolveType: parent => parent.__typename // 2. ... means a very simple check in `__resolveType`
    }

    Using resolversNonOptionalTypename: add it into typescript-resolvers plugin config:

    // codegen.ts
    const config: CodegenConfig = {
      schema: 'src/schema/**/*.graphql',
      generates: {
        'src/schema/types.ts': {
          plugins: ['typescript', 'typescript-resolvers'],
          config: {
            resolversNonOptionalTypename: true // Or `resolversNonOptionalTypename: { unionMember: true }`
          }
        }
      }
    }

Patch Changes

  • #9206 e56790104 Thanks @eddeee888! - Fix ResolversUnionTypes being used in ResolversParentTypes

    Previously, objects with mappable fields are converted to Omit format that references its own type group or ResolversTypes or ResolversParentTypes e.g.

    export type ResolversTypes = {
      Book: ResolverTypeWrapper<BookMapper>
      BookPayload: ResolversTypes['BookResult'] | ResolversTypes['StandardError']
      // Note: `result` on the next line references `ResolversTypes["Book"]`
      BookResult: ResolverTypeWrapper<
        Omit<BookResult, 'result'> & { result?: Maybe<ResolversTypes['Book']> }
      >
      StandardError: ResolverTypeWrapper<StandardError>
    }
    
    export type ResolversParentTypes = {
      Book: BookMapper
      BookPayload: ResolversParentTypes['BookResult'] | ResolversParentTypes['StandardError']
      // Note: `result` on the next line references `ResolversParentTypes["Book"]`
      BookResult: Omit<BookResult, 'result'> & { result?: Maybe<ResolversParentTypes['Book']> }
      StandardError: StandardError
    }

    In https://github.com/dotansimha/graphql-code-generator/pull/9069, we extracted resolver union types to its own group:

    export type ResolversUnionTypes = {
      // Note: `result` on the next line references `ResolversTypes["Book"]` which is only correct for the `ResolversTypes` case
      BookPayload:
        | (Omit<BookResult, 'result'> & { result?: Maybe<ResolversTypes['Book']> })
        | StandardError
    }
    
    export type ResolversTypes = {
      Book: ResolverTypeWrapper<BookMapper>
      BookPayload: ResolverTypeWrapper<ResolversUnionTypes['BookPayload']>
      BookResult: ResolverTypeWrapper<
        Omit<BookResult, 'result'> & { result?: Maybe<ResolversTypes['Book']> }
      >
      StandardError: ResolverTypeWrapper<StandardError>
    }
    
    export type ResolversParentTypes = {
      Book: BookMapper
      BookPayload: ResolversUnionTypes['BookPayload']
      BookResult: Omit<BookResult, 'result'> & { result?: Maybe<ResolversParentTypes['Book']> }
      StandardError: StandardError
    }

    This change creates an extra ResolversUnionParentTypes that is referenced by ResolversParentTypes to ensure backwards compatibility:

    export type ResolversUnionTypes = {
      BookPayload:
        | (Omit<BookResult, 'result'> & { result?: Maybe<ResolversParentTypes['Book']> })
        | StandardError
    }
    
    // ... and the reference is changed in ResolversParentTypes:
    export type ResolversParentTypes = {
      // ... other fields
      BookPayload: ResolversUnionParentTypes['BookPayload']
    }
  • #9194 acb647e4e Thanks @dstaley! - Don’t emit import statements for unused fragments

  • Updated dependencies [b7dacb21f, f104619ac]:

    • @graphql-codegen/plugin-helpers@4.2.0

3.0.2

Patch Changes

3.0.1

Patch Changes

3.0.0

Major Changes

Patch Changes

2.13.8

Patch Changes

  • #8816 a98198524 Thanks @charle692! - Fix issue where visitor-plugin-common emitted ESM imports for Operations when emitLegacyCommonJSImports is true

2.13.7

Patch Changes

2.13.6

Patch Changes

2.13.5

Patch Changes

  • 46f75304a Thanks @saihaj! - fix the version of @graphql-codegen/plugin-helpers@3.1.1

  • Updated dependencies [307a5d350]:

    • @graphql-codegen/plugin-helpers@3.1.1

2.13.4

Patch Changes

2.13.3

Patch Changes

2.13.2

Patch Changes

  • #8586 ef4c2c9c2 Thanks @levrik! - Fix incompatibility between @oneOf input types and declaration kind other than type

2.13.1

Patch Changes

2.13.0

Minor Changes

2.12.2

Patch Changes

2.12.1

Patch Changes

2.12.0

Minor Changes

  • 2cbcbb371: Add new flag to emit legacy common js imports. Default it will be true this way it ensure that generated code works with non-compliant bundlers.

    You can use the option in your config:

    schema: 'schema.graphql'
     documents:
       - 'src/**/*.graphql'
     emitLegacyCommonJSImports: true

    Alternative you can use the CLI to set this option:

    $ codegen --config-file=config.yml --emit-legacy-common-js-imports

Patch Changes

  • Updated dependencies [2cbcbb371]
    • @graphql-codegen/plugin-helpers@2.6.0

2.11.1

Patch Changes

  • 525ad580b: Revert breaking change for Next.js applications that are incapable of resolving an import with a .js extension.

2.11.0

Minor Changes

Patch Changes

  • Updated dependencies [d84afec09]
  • Updated dependencies [a4fe5006b]
  • Updated dependencies [8e44df58b]
    • @graphql-codegen/plugin-helpers@2.5.0

2.10.0

Minor Changes

  • aa1e6eafd: Add @Deprecated support for input

Patch Changes

  • a42fcbfe4: docs: Swapping rootValueType with directiveContextTypes for correctness
  • 8b10f22be: Ensure falsy enum values are still mapped

2.9.1

Patch Changes

  • d16bebacb: Update @graphql-tools/relay-operation-optimizer package;
    • Previously that package used relay-compiler@12 which has graphql v15 as a peer dependency and it was causing peer dependency warnings if user installs a different version of graphql package. Now we forked and released v12 under a different name and removed version range for graphql in peerDependencies of relay-compiler

2.9.0

Minor Changes

  • c3d7b7226: support the @oneOf directive on input types.

2.8.0

Minor Changes

  • f1fb77bd4: feat: Add option to squash exactly similar fragment types

2.7.6

Patch Changes

  • 9a5f31cb6: New option onlyEnums for Typescript

2.7.5

Patch Changes

  • 2966686e9: Generate $fragmentName for fragment subtypes for fragment masking

2.7.4

Patch Changes

  • 337fd4f77: WP: [typescript-resolvers] Add directiveContextTypes option

2.7.3

Patch Changes

  • 54718c039: Improve @Deprecated Enum Type developer experience

2.7.2

Patch Changes

  • 11d05e361: fix(resolvers): fix conflict between typesPrefix: true and enumPrefix: false

2.7.1

Patch Changes

  • fd55e2039: fix incorrect type generation when using the inlineFragmentTypes ‘combine’ option that resulted in generating masked fragment output.

2.7.0

Minor Changes

  • 1479233df: Add new inlineFragmentTypes mode 'mask', which allows generating masked fragment types.

2.6.0

Minor Changes

  • bef4376d5: fix: RequireFields generic making all other fields optional

Patch Changes

  • c8ef37ae0: fix(typescript-resolvers): Fix optional field types
  • be7cb3a82: Performance work: resolvers plugins, documents loading
  • Updated dependencies [754a33715]
    • @graphql-codegen/plugin-helpers@2.4.0

2.5.2

Patch Changes

  • 6002feb3d: Fix exports in package.json files for react-native projects
  • Updated dependencies [6002feb3d]
    • @graphql-codegen/plugin-helpers@2.3.2

2.5.1

Patch Changes

  • a9f1f1594: Use maybeValue as default output for optionals on preResolveTypes: true
  • 9ea6621ec: add missing ListType method parameters

2.5.0

Minor Changes

  • 97ddb487a: feat: GraphQL v16 compatibility

Patch Changes

  • Updated dependencies [97ddb487a]
    • @graphql-codegen/plugin-helpers@2.3.0

2.4.0

Minor Changes

  • ad02cb9b8: Fixed an issue where ResolversParentTypes referenced non-existing fields of ResolversParentTypes when the corresponding type was a mapped enum.

2.3.0

Minor Changes

  • b9e85adae: feat(visitor-plugin-common): support custom scalar type from extensions

Patch Changes

  • 3c2c847be: Fix dedupleFragments option for typescript-react-query (and possibly others)
  • Updated dependencies [7c60e5acc]
    • @graphql-codegen/plugin-helpers@2.2.0

2.2.1

Patch Changes

  • 0b090e31a: Apply proper indentation to DirectiveArgs types

2.2.0

Minor Changes

  • d6c2d4c09: Allow declaring Argument and InputType field mappings based on directive annotations.

    WARNING: Using this option does only change the type definitions.

    For actually ensuring that a type is correct at runtime you will have to use schema transforms (e.g. with @graphql-tools/utils mapSchema) that apply those rules! Otherwise, you might end up with a runtime type mismatch which could cause unnoticed bugs or runtime errors.

    Please use this configuration option with care!

    plugins:
      config:
        directiveArgumentAndInputFieldMappings:
          asNumber: number
    directive @asNumber on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
    
    input MyInput {
      id: ID! @asNumber
    }
    
    type User {
      id: ID!
    }
    
    type Query {
      user(id: ID! @asNumber): User
    }

    Usage e.g. with typescript-resolvers

    const Query: QueryResolvers = {
      user(_, args) {
        // args.id is of type 'number'
      }
    }
  • 5086791ac: Allow overwriting the resolver type signature based on directive usages.

    WARNING: Using this option does only change the generated type definitions.

    For actually ensuring that a type is correct at runtime you will have to use schema transforms (e.g. with @graphql-tools/utils mapSchema) that apply those rules! Otherwise, you might end up with a runtime type mismatch which could cause unnoticed bugs or runtime errors.

    Example configuration:

    config:
      # This was possible before
      customResolverFn: ../resolver-types.ts#UnauthenticatedResolver
      # This is new
      directiveResolverMappings:
        authenticated: ../resolvers-types.ts#AuthenticatedResolver

    Example mapping file (resolver-types.ts):

    export type UnauthenticatedContext = {
      user: null
    }
    
    export type AuthenticatedContext = {
      user: { id: string }
    }
    
    export type UnauthenticatedResolver<TResult, TParent, _TContext, TArgs> = (
      parent: TParent,
      args: TArgs,
      context: UnauthenticatedContext,
      info: GraphQLResolveInfo
    ) => Promise<TResult> | TResult
    
    export type AuthenticatedResolver<TResult, TParent, _TContext, TArgs> = (
      parent: TParent,
      args: TArgs,
      context: AuthenticatedContext,
      info: GraphQLResolveInfo
    ) => Promise<TResult> | TResult

    Example Schema:

    directive @authenticated on FIELD_DEFINITION
    
    type Query {
      yee: String
      foo: String @authenticated
    }

Patch Changes

  • feeae1c66: Do not throw an error when trying to merge inline fragment usages.

2.1.2

Patch Changes

  • 6470e6cc9: fix(plugin-helpers): remove unnecessary import
  • 263570e50: Don’t generate duplicate imports for the same identifier
  • Updated dependencies [6470e6cc9]
  • Updated dependencies [35199dedf]
    • @graphql-codegen/plugin-helpers@2.1.1

2.1.1

Patch Changes

  • aabeff181: Don’t generate import statements for fragments declared in the file we’re outputting to

2.1.0

Minor Changes

  • 290170262: add getOperationVariableName function to ClientSideBasePluginConfig class
  • 440172cfe: support ESM

Patch Changes

  • 24185985a: bump graphql-tools package versions
  • Updated dependencies [24185985a]
  • Updated dependencies [39773f59b]
  • Updated dependencies [440172cfe]
    • @graphql-codegen/plugin-helpers@2.1.0

2.0.0

Major Changes

  • d80efdec4: Change preResolveTypes default to be true for more readable types

  • b0cb13df4: Update to latest graphql-tools and graphql-config version.

    ‼️ ‼️ ‼️ Please note ‼️ ‼️ ‼️:

    This is a breaking change since Node 10 is no longer supported in graphql-tools, and also no longer supported for Codegen packages.

Patch Changes

  • d80efdec4: Add option inlineFragmentTypes for deep inlining fragment types within operation types. This inlineFragmentTypes is set to inline by default (Previous behaviour is combine).

    This behavior is the better default for users that only use Fragments for building operations and then want to have access to all the data via the operation type (instead of accessing slices of the data via fragments).

  • Updated dependencies [b0cb13df4]

    • @graphql-codegen/plugin-helpers@2.0.0

1.22.0

Minor Changes

  • 9005cc17: add allowEnumStringTypes option for allowing string literals as valid return types from resolvers in addition to enum values._

Patch Changes

  • df19a4ed: Allow multiple {T} instances in defaultMapper
  • Updated dependencies [470336a1]
    • @graphql-codegen/plugin-helpers@1.18.8

1.21.3

Patch Changes

  • 6762aff5: Fix for array types with @skip @include directives

1.21.2

Patch Changes

  • 6aaecf1c: Fix issues with missing sub-fragments when skipTypename: true

1.21.1

Patch Changes

  • cf1e5abc: Introduce new feature for removing duplicated fragments

1.21.0

Minor Changes

  • 8da7dff6: Skip typechecking on generated values by casting to unknown

Patch Changes

  • dfd25caf: chore(deps): bump graphql-tools versions
  • Updated dependencies [dfd25caf]
    • @graphql-codegen/plugin-helpers@1.18.7

1.20.0

Minor Changes

  • f0b5ea53: Add entireFieldWrapperValue configuration option, to wrap arrays
  • 097bea2f: Added new configuration settings for scalars: strictScalars and defaultScalarType

Patch Changes

  • d9212aa0: fix(visitor-plugin-common): guard for a runtime type error
  • Updated dependencies [d9212aa0]
    • @graphql-codegen/plugin-helpers@1.18.5

1.19.1

Patch Changes

  • 23862e7e: fix(naming-convention): revert and pin change-case-all dependency for workaround #3256
  • Updated dependencies [23862e7e]
    • @graphql-codegen/plugin-helpers@1.18.4

1.19.0

Minor Changes

  • d4942d04: NEW CONFIG (onlyResolveTypeForInterfaces): Allow to generate only __resolveType for interfaces

Patch Changes

  • e947f8e3: Allow to have declarationKind of type: class, interface: interface
  • 29b75b1e: enhance(docs): improve docs for naming convention
  • 1f6f3db6: Fix for @skip @include directives upon arrays
  • 29b75b1e: enhance(namingConvention): use change-case-all instead of individual packages for naming convention
  • Updated dependencies [29b75b1e]
    • @graphql-codegen/plugin-helpers@1.18.3

1.18.3

Patch Changes

  • 5749cb8a: chore: fix type-level incompatibilities of the avoidOptionals
  • 5a12fe58: fix type error on parsing enums

1.18.2

Patch Changes

  • ca66569f: Fix issues with undefined calls for str.replace

1.18.1

Patch Changes

  • 63be0f40: Fix issues with empty interfaces causing syntax issues
  • 190482a1: add support for fragment variables
  • 4444348d: Correctly escape enum values defined in the GraphQLSchema object
  • 142b32b3: Better support for @skip/@include directives with complex selection sets
  • 42213fa0: Strip trailing whitespace from some output

1.18.0

Minor Changes

  • bd4bf7cf: feat(visitor-plugin-common): add ignoreEnumValuesFromSchema to ignore enum values from GraphQLSchema

1.17.22

Patch Changes

  • 64293437: Support for input lists coercion
  • fd5843a7: Fixed a bug where some import namespacing is missed when generating resolver types.
  • d75051f5: generate correct types for fragments with an interface type condition that are spread on an interface field.

1.17.21

Patch Changes

  • 8356f8a2: Extended behaviour to allow support in internalResolversPrefix flag for resolvers plugin

1.17.20

Patch Changes

  • 1183d173: Bump all packages to resolve issues with shared dependencies
  • Updated dependencies [1183d173]
    • @graphql-codegen/plugin-helpers@1.18.2

1.17.19

Patch Changes

  • 99819bf1: Improve DocumentNode optimization for plugins that generate it
  • c3b59e81: Extract buildMapperImport to external function

1.17.18

Patch Changes

  • faa13973: Fixed a bug in parseMapper that were preventing to use mappers with complex type usages

1.17.17

Patch Changes

  • 612e5e52: remove broken isTypeOf call for expanding fragments with flattenGeneratedTypes = true
  • 9f2a4e2f: Expose _hasRequiredVariables to buildOperation in order to allow better type-safety for plugins that deals with variables
  • 0f35e775: Fix issues with incorrect naming of operation and variables when used with typesSuffix
  • Updated dependencies [eaf45d1f]
    • @graphql-codegen/plugin-helpers@1.18.1

1.17.16

Patch Changes

  • 92d8f876: Fixed unquoted numeric enum identifiers

1.17.15

Patch Changes

  • d2cde3d5: fixed isTypeOf resolvers signature
  • 89a6aa80: Fixes issues with typesSuffix and arguments type name
  • f603b8f8: Support unnamed queries in operation visitors
  • Updated dependencies [da8bdd17]
    • @graphql-codegen/plugin-helpers@1.17.9

1.17.14

Patch Changes

  • 07f9b1b2: Fix a bug caused numeric enum values defined in the GraphQLSchema to be printed incorrectly
  • 35f67120: bugfix: allow to specify mappers for GraphQL interface and override the default behaviour.

1.17.13

Patch Changes

  • 1d7c6432: Bump all packages to allow ”^” in deps and fix compatibility issues
  • 1d7c6432: Bump versions of @graphql-tools/ packages to fix issues with loading schemas and SDL comments
  • Updated dependencies [1d7c6432]
  • Updated dependencies [1d7c6432]
    • @graphql-codegen/plugin-helpers@1.17.8

1.17.12

Patch Changes

  • 4266a15f: Allow getDocumentNodeSignature to control the entire generation flow of the typed documents

1.17.11

Patch Changes

  • ee2b01a3: Fixes for issues with publish command

1.17.10

Patch Changes

  • 6cb9c96d: Fixes issues with previous release

1.17.9

Patch Changes

  • bccfd28c: Allow to set gqlImport to a clean gql string and skip import generating

1.17.8

Patch Changes

  • ce3a5798: Publish minor version to include fixes for client-side-base-visitor, required to v2 of ts-react-apollo plugin (for unified apollo import)