Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.
Releases
@graphql-codegen/[email protected]
Major Changes
2256c8b5dThanks @beerose! - AddTypedDocumentNodestring alternative that doesn't require GraphQL AST on the client. This change requires@graphql-typed-document-node/corein version3.2.0or higher.Patch Changes
e56790104,b7dacb21f,f104619ac,acb647e4e,9f4d9c5a4]:@graphql-codegen/[email protected]
Major Changes
2256c8b5dThanks @beerose! - AddTypedDocumentNodestring alternative that doesn't require GraphQL AST on the client. This change requires@graphql-typed-document-node/corein version3.2.0or higher.Patch Changes
e56790104,b7dacb21f,f104619ac,acb647e4e,9f4d9c5a4]:@graphql-codegen/[email protected]
Major Changes
2256c8b5dThanks @beerose! - AddTypedDocumentNodestring alternative that doesn't require GraphQL AST on the client. This change requires@graphql-typed-document-node/corein version3.2.0or higher.Patch Changes
2256c8b5dThanks @beerose! - dependencies updates:@graphql-typed-document-node/[email protected]↗︎ (from3.1.2, independencies)e56790104,b7dacb21f,f104619ac,92d86b009,2256c8b5d,acb647e4e,9f4d9c5a4]:@graphql-codegen/[email protected]
Minor Changes
#9151
b7dacb21fThanks @'./user/schema.mappers#UserMapper',! - AddwatchPatternconfig option forgeneratessections.By default,
watchmode automatically watches all GraphQL schema and document files. This means when a change is detected, Codegen CLI is run.A user may want to run Codegen CLI when non-schema and non-document files are changed. Each
generatessection now has awatchPatternoption to allow more file patterns to be added to the list of patterns to watch.In the example below, mappers are exported from
schema.mappers.tsfiles. We want to re-run Codegen if the content of*.mappers.tsfiles change because they change the generated types file. To solve this, we can add mapper file patterns to watch using the glob pattern used for schema and document files.Then, run Codegen CLI in
watchmode:Now, updating
*.mappers.tsfiles re-runs Codegen! 🎉Note:
watchPatternis only used inwatchmode i.e. running CLI with--watchflag.Patch Changes
b7dacb21f,f104619ac]:@graphql-codegen/[email protected]
Minor Changes
#9146
9f4d9c5a4Thanks @eddeee888! - [typescript-resolvers] AddresolversNonOptionalTypenameconfig option.This is extending on
ResolversUnionTypesimplemented in [typescript-resolvers] Extract union types to ResolversUnionTypes #9069resolversNonOptionalTypenameadds non-optional__typenameto union members ofResolversUnionTypes, without affecting the union members' base intefaces.A common use case for non-optional
__typenameof union members is using it as the common field to work out the final schema type. This makes implementing the union's__resolveTypevery simple as we can use__typenameto 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:
With optional
__typename: We need to check existence of certain fields to resolve type in the union resolver:With non-optional
__typename: Resolvers declare the type. This which gives us better TypeScript support in resolvers and simplify__resolveTypeimplementation:Using
resolversNonOptionalTypename: add it intotypescript-resolversplugin config:Patch Changes
#9206
e56790104Thanks @eddeee888! - FixResolversUnionTypesbeing used inResolversParentTypesPreviously, objects with mappable fields are converted to Omit format that references its own type group or
ResolversTypesorResolversParentTypese.g.In [typescript-resolvers] Extract union types to ResolversUnionTypes #9069, we extracted resolver union types to its own group:
This change creates an extra
ResolversUnionParentTypesthat is referenced byResolversParentTypesto ensure backwards compatibility:#9194
acb647e4eThanks @dstaley! - Don't emit import statements for unused fragmentsUpdated dependencies [
b7dacb21f,f104619ac]:@graphql-codegen/[email protected]
Minor Changes
#9146
9f4d9c5a4Thanks @eddeee888! - [typescript-resolvers] AddresolversNonOptionalTypenameconfig option.This is extending on
ResolversUnionTypesimplemented in [typescript-resolvers] Extract union types to ResolversUnionTypes #9069resolversNonOptionalTypenameadds non-optional__typenameto union members ofResolversUnionTypes, without affecting the union members' base intefaces.A common use case for non-optional
__typenameof union members is using it as the common field to work out the final schema type. This makes implementing the union's__resolveTypevery simple as we can use__typenameto 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:
With optional
__typename: We need to check existence of certain fields to resolve type in the union resolver:With non-optional
__typename: Resolvers declare the type. This which gives us better TypeScript support in resolvers and simplify__resolveTypeimplementation:Using
resolversNonOptionalTypename: add it intotypescript-resolversplugin config:Patch Changes
#9206
e56790104Thanks @eddeee888! - FixResolversUnionTypesbeing used inResolversParentTypesPreviously, objects with mappable fields are converted to Omit format that references its own type group or
ResolversTypesorResolversParentTypese.g.In [typescript-resolvers] Extract union types to ResolversUnionTypes #9069, we extracted resolver union types to its own group:
This change creates an extra
ResolversUnionParentTypesthat is referenced byResolversParentTypesto ensure backwards compatibility:f104619acThanks @saihaj! - Resolve issue with nesting fields in@providesdirective being preventedUpdated dependencies [
e56790104,b7dacb21f,f104619ac,92d86b009,acb647e4e,9f4d9c5a4]:@graphql-codegen/[email protected]
Minor Changes
#9151
b7dacb21fThanks @'./user/schema.mappers#UserMapper',! - AddwatchPatternconfig option forgeneratessections.By default,
watchmode automatically watches all GraphQL schema and document files. This means when a change is detected, Codegen CLI is run.A user may want to run Codegen CLI when non-schema and non-document files are changed. Each
generatessection now has awatchPatternoption to allow more file patterns to be added to the list of patterns to watch.In the example below, mappers are exported from
schema.mappers.tsfiles. We want to re-run Codegen if the content of*.mappers.tsfiles change because they change the generated types file. To solve this, we can add mapper file patterns to watch using the glob pattern used for schema and document files.Then, run Codegen CLI in
watchmode:Now, updating
*.mappers.tsfiles re-runs Codegen! 🎉Note:
watchPatternis only used inwatchmode i.e. running CLI with--watchflag.Patch Changes
f104619acThanks @saihaj! - Resolve issue with nesting fields in@providesdirective being prevented@graphql-codegen/[email protected]
Patch Changes
e56790104,b7dacb21f,f104619ac,acb647e4e,9f4d9c5a4]:@graphql-codegen/[email protected]
Patch Changes
e56790104,b7dacb21f,f104619ac,92d86b009,acb647e4e,9f4d9c5a4]:@graphql-codegen/[email protected]
Patch Changes
#9150
92d86b009Thanks @rliljest! - Properly escape enum identifiers when enumsAsConst is usedUpdated dependencies [
e56790104,b7dacb21f,f104619ac,acb647e4e,9f4d9c5a4]:@graphql-codegen/[email protected]
Patch Changes
e56790104,b7dacb21f,f104619ac,acb647e4e,9f4d9c5a4]:@graphql-codegen/[email protected]
Patch Changes
#9228
a5ec5af36Thanks @eddeee888! - Add complex test cases for resolvers testsUpdated dependencies [
b7dacb21f,f104619ac]: