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
2256c8b5d
Thanks @beerose! - AddTypedDocumentNode
string alternative that doesn't require GraphQL AST on the client. This change requires@graphql-typed-document-node/core
in version3.2.0
or higher.Patch Changes
e56790104
,b7dacb21f
,f104619ac
,acb647e4e
,9f4d9c5a4
]:@graphql-codegen/[email protected]
Major Changes
2256c8b5d
Thanks @beerose! - AddTypedDocumentNode
string alternative that doesn't require GraphQL AST on the client. This change requires@graphql-typed-document-node/core
in version3.2.0
or higher.Patch Changes
e56790104
,b7dacb21f
,f104619ac
,acb647e4e
,9f4d9c5a4
]:@graphql-codegen/[email protected]
Major Changes
2256c8b5d
Thanks @beerose! - AddTypedDocumentNode
string alternative that doesn't require GraphQL AST on the client. This change requires@graphql-typed-document-node/core
in version3.2.0
or higher.Patch Changes
2256c8b5d
Thanks @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
b7dacb21f
Thanks @'./user/schema.mappers#UserMapper',! - AddwatchPattern
config option forgenerates
sections.By default,
watch
mode 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
generates
section now has awatchPattern
option 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.ts
files. We want to re-run Codegen if the content of*.mappers.ts
files 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
watch
mode:Now, updating
*.mappers.ts
files re-runs Codegen! 🎉Note:
watchPattern
is only used inwatch
mode i.e. running CLI with--watch
flag.Patch Changes
b7dacb21f
,f104619ac
]:@graphql-codegen/[email protected]
Minor Changes
#9146
9f4d9c5a4
Thanks @eddeee888! - [typescript-resolvers] AddresolversNonOptionalTypename
config option.This is extending on
ResolversUnionTypes
implemented in [typescript-resolvers] Extract union types to ResolversUnionTypes #9069resolversNonOptionalTypename
adds non-optional__typename
to union members ofResolversUnionTypes
, 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:
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__resolveType
implementation:Using
resolversNonOptionalTypename
: add it intotypescript-resolvers
plugin config:Patch Changes
#9206
e56790104
Thanks @eddeee888! - FixResolversUnionTypes
being used inResolversParentTypes
Previously, objects with mappable fields are converted to Omit format that references its own type group or
ResolversTypes
orResolversParentTypes
e.g.In [typescript-resolvers] Extract union types to ResolversUnionTypes #9069, we extracted resolver union types to its own group:
This change creates an extra
ResolversUnionParentTypes
that is referenced byResolversParentTypes
to ensure backwards compatibility:#9194
acb647e4e
Thanks @dstaley! - Don't emit import statements for unused fragmentsUpdated dependencies [
b7dacb21f
,f104619ac
]:@graphql-codegen/[email protected]
Minor Changes
#9146
9f4d9c5a4
Thanks @eddeee888! - [typescript-resolvers] AddresolversNonOptionalTypename
config option.This is extending on
ResolversUnionTypes
implemented in [typescript-resolvers] Extract union types to ResolversUnionTypes #9069resolversNonOptionalTypename
adds non-optional__typename
to union members ofResolversUnionTypes
, 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:
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__resolveType
implementation:Using
resolversNonOptionalTypename
: add it intotypescript-resolvers
plugin config:Patch Changes
#9206
e56790104
Thanks @eddeee888! - FixResolversUnionTypes
being used inResolversParentTypes
Previously, objects with mappable fields are converted to Omit format that references its own type group or
ResolversTypes
orResolversParentTypes
e.g.In [typescript-resolvers] Extract union types to ResolversUnionTypes #9069, we extracted resolver union types to its own group:
This change creates an extra
ResolversUnionParentTypes
that is referenced byResolversParentTypes
to ensure backwards compatibility:f104619ac
Thanks @saihaj! - Resolve issue with nesting fields in@provides
directive being preventedUpdated dependencies [
e56790104
,b7dacb21f
,f104619ac
,92d86b009
,acb647e4e
,9f4d9c5a4
]:@graphql-codegen/[email protected]
Minor Changes
#9151
b7dacb21f
Thanks @'./user/schema.mappers#UserMapper',! - AddwatchPattern
config option forgenerates
sections.By default,
watch
mode 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
generates
section now has awatchPattern
option 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.ts
files. We want to re-run Codegen if the content of*.mappers.ts
files 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
watch
mode:Now, updating
*.mappers.ts
files re-runs Codegen! 🎉Note:
watchPattern
is only used inwatch
mode i.e. running CLI with--watch
flag.Patch Changes
f104619ac
Thanks @saihaj! - Resolve issue with nesting fields in@provides
directive 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
92d86b009
Thanks @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
a5ec5af36
Thanks @eddeee888! - Add complex test cases for resolvers testsUpdated dependencies [
b7dacb21f
,f104619ac
]: