Releases: dotansimha/graphql-code-generator-community
February 01, 2023
@graphql-codegen/[email protected]
Patch Changes
- #72
c70b4ce49
Thanks @MitkoTschimev! - missing trailing comma in enums
BeforeNowenum AssetOrder { @JsonKey(name: 'contentType_ASC') contentTypeAsc @JsonKey(name: 'contentType_DESC') contentTypeDesc }
enum AssetOrder { @JsonKey(name: 'contentType_ASC') contentTypeAsc, @JsonKey(name: 'contentType_DESC') contentTypeDesc, }
@graphql-codegen/[email protected]
Minor Changes
-
#75
7e80265e9
Thanks @DominicGBauer! - [typescript-rtk-query] feat: add importAlternateApiName to conifg optionsAdd functionality to allow users to use the optional config variable importAlternateApiName to change the api name of the import used by baseApi. It will default to 'api'.
January 31, 2023
@graphql-codegen/[email protected]
Patch Changes
-
#74
349dc3a58
Thanks @Parables! - docs(plugin config): 📝 updated plugin-configadded @type decorators, added missing TypeName and FieldName variables in the exampleMarkdowns
Breaking: mergeTypes signature changed to mergeTypes?: Record<string, TypeName[]>
Even though the key is a string, we recommend that you use the value of a TypeName.Example:
import type { CodegenConfig } from '@graphql-codegen/cli'; const Movie = TypeName.fromString('Movie'); const CreateMovieInput = TypeName.fromString('CreateMovieInput'); const UpdateMovieInput = TypeName.fromString('UpdateMovieInput'); const UpsertMovieInput = TypeName.fromString('UpsertMovieInput'); const config: CodegenConfig = { generates: { 'lib/data/models/app_models.dart': { plugins: { 'flutter-freezed': { mergeTypes: { [Movie.value]: [CreateMovieInput, UpdateMovieInput, UpsertMovieInput], }, }, }, }, }, }; export default config;
@graphql-codegen/[email protected]
Minor Changes
January 22, 2023
@graphql-codegen/[email protected]
Major Changes
-
#47
f56200632
Thanks @Parables! - # Configuring the plugin using patternsWhat has changed
The following type definitions have been removed:
-
CustomDecorator = Record<string, DecoratorToFreezed>;
-
DecoratorToFreezed
- arguments?: string[];
- applyOn: ApplyDecoratorOn[];
- mapsToFreezedAs: '@default' | '@deprecated' | 'final' | 'directive' | 'custom';
-
FieldConfig
- final?: boolean;
- deprecated?: boolean;
- defaultValue?: any;
- customDecorators?: CustomDecorator;
-
FreezedConfig
- alwaysUseJsonKeyName?: boolean;
- copyWith?: boolean;
- customDecorators?: CustomDecorator;
- defaultUnionConstructor?: boolean;
- equal?: boolean;
- fromJsonToJson?: boolean;
- immutable?: boolean;
- makeCollectionsUnmodifiable?: boolean;
- mergeInputs?: string[];
- mutableInputs?: boolean;
- privateEmptyConstructor?: boolean;
- unionKey?: string;
- unionValueCase?: 'FreezedUnionCase.camel' | 'FreezedUnionCase.pascal';
-
TypeSpecificFreezedConfig
- deprecated?: boolean;
- config?: FreezedConfig;
- fields?: Record<string, FieldConfig>;
-
FlutterFreezedPluginConfig:
- fileName?: string;
- globalFreezedConfig?: FreezedConfig
- typeSpecificFreezedConfig?: Record<string, TypeSpecificFreezedConfig>;
Why those type definitions were removed
The previous version allow you to configure GraphQL Types and its fields globally using the
globalFreezedConfig
and override the global configuration with specific ones of each GraphQL Type using thetypeSpecificFreezedConfig
.This resulted in a bloated configuration file with duplicated configuration for the same options but for different cases.
To emphasize on the problem, consider the before and after configurations below:
Before:
{ globalFreezedConfig: { immutable: true, }, typeSpecificFreezedConfig: { Starship: { deprecated: true, }, Droid: { config: { immutable: false, }, fields: { id: { deprecated: true, }, }, }, }, };
After:
{ immutable: TypeNamePattern.forAllTypeNamesExcludeTypeNames([Droid]), deprecated: [ [TypeNamePattern.forTypeNames([Starship]), ['default_factory']], [FieldNamePattern.forFieldNamesOfTypeName([[Droid, id]]), ['default_factory_parameter']], ], }
The 2 configurations above do the same thing, the later being more compact, flexible and readable than the former.
How to update your existing configuration
First understand the usage of the Patterns, then create a new config file(preferably a typescript file: previous version of the code generator used a YAML file).
And implement the new configuration one by one inspecting the generated output.Please avoid migrating all your configuration at once. Doing that means you wont be able to inspect the generated output and ensure that the expected results are produced.
-
@graphql-codegen/[email protected]
Minor Changes
@graphql-codegen/[email protected]
Patch Changes
- #45
296ce64c0
Thanks @FloEdelmann! - Default to empty object foroptions
parameter in generated mutation functions, even those with required variables.
January 16, 2023
@graphql-codegen/[email protected]
Minor Changes
- #25
a70964409
Thanks @EandrewJones! - Reverts problematic part of PR #8497. That PR fixed an issue with infinite query generated hooks not utilizing pageParamKeys for custom fetchers but in the process introduced a type error. This removes the cause of the type error.
January 05, 2023
@graphql-codegen/[email protected]
Minor Changes
- #24
41b0ae176
Thanks @gwesseling! - Added the fileName option for the near-operation-file-preset to force the generated filename
November 24, 2022
@graphql-codegen/[email protected]
Patch Changes
- #21
8a0359623
Thanks @charlypoly! - doc API examples fix
@graphql-codegen/[email protected]
Patch Changes
- #19
d98ca30cd
Thanks @charlypoly! - Fix compatibility of graphql-request fetcher with >5.0