From d26bfad8b4bfd944303d785dc0bfa4a797702b5b Mon Sep 17 00:00:00 2001 From: Martin Kamleithner Date: Sat, 11 Feb 2023 00:46:33 +0100 Subject: [PATCH 1/8] fix(gql_code_builder): improve variable resolution in fragment types --- .../alias_var_fragment.ast.gql.dart | 113 ++ .../alias_var_fragment.data.gql.dart | 245 ++++ .../alias_var_fragment.data.gql.g.dart | 1272 +++++++++++++++++ .../alias_var_fragment.req.gql.dart | 39 + .../alias_var_fragment.req.gql.g.dart | 170 +++ .../alias_var_fragment.var.gql.dart | 49 + .../alias_var_fragment.var.gql.g.dart | 262 ++++ .../aliased_hero.data.gql.g.dart | 30 +- .../__generated__/aliased_hero.req.gql.g.dart | 8 +- .../__generated__/aliased_hero.var.gql.g.dart | 7 +- .../lib/aliases/alias_var_fragment.graphql | 15 + .../hero_with_fragments.data.gql.g.dart | 75 +- .../hero_with_fragments.req.gql.g.dart | 8 +- .../hero_with_fragments.var.gql.g.dart | 12 +- ...terface_subtyped_fragments.data.gql.g.dart | 110 +- ...nterface_subtyped_fragments.req.gql.g.dart | 8 +- ...nterface_subtyped_fragments.var.gql.g.dart | 7 +- .../graphql/__generated__/schema.ast.gql.dart | 152 ++ .../__generated__/schema.schema.gql.dart | 42 + .../__generated__/schema.schema.gql.g.dart | 283 +++- .../__generated__/serializers.gql.dart | 34 +- .../__generated__/serializers.gql.g.dart | 18 +- .../lib/graphql/schema.graphql | 24 + .../hero_for_episode.data.gql.g.dart | 44 +- .../hero_for_episode.req.gql.g.dart | 8 +- .../hero_for_episode.var.gql.g.dart | 7 +- .../hero_no_vars.data.gql.g.dart | 16 +- .../__generated__/hero_no_vars.req.gql.g.dart | 8 +- .../__generated__/hero_no_vars.var.gql.g.dart | 2 +- .../review_with_date.data.gql.g.dart | 28 +- .../review_with_date.req.gql.g.dart | 8 +- .../review_with_date.var.gql.g.dart | 10 +- .../create_review.data.gql.g.dart | 19 +- .../create_review.req.gql.g.dart | 8 +- .../create_review.var.gql.g.dart | 8 +- .../human_with_args.data.gql.g.dart | 16 +- .../human_with_args.req.gql.g.dart | 8 +- .../human_with_args.var.gql.g.dart | 7 +- .../gql_code_builder/lib/src/frag_vars.dart | 62 +- 39 files changed, 3095 insertions(+), 147 deletions(-) create mode 100644 codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.ast.gql.dart create mode 100644 codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.dart create mode 100644 codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.g.dart create mode 100644 codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.dart create mode 100644 codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.g.dart create mode 100644 codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.dart create mode 100644 codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.g.dart create mode 100644 codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.ast.gql.dart b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.ast.gql.dart new file mode 100644 index 00000000..f559a4f1 --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.ast.gql.dart @@ -0,0 +1,113 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:gql/ast.dart' as _i1; + +const PostFragment = _i1.FragmentDefinitionNode( + name: _i1.NameNode(value: 'PostFragment'), + typeCondition: _i1.TypeConditionNode( + on: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'Post'), + isNonNull: false, + )), + directives: [], + selectionSet: _i1.SelectionSetNode(selections: [ + _i1.FieldNode( + name: _i1.NameNode(value: 'id'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + _i1.FieldNode( + name: _i1.NameNode(value: 'favoritedUsers'), + alias: _i1.NameNode(value: 'isFavorited'), + arguments: [ + _i1.ArgumentNode( + name: _i1.NameNode(value: 'where'), + value: _i1.ObjectValueNode(fields: [ + _i1.ObjectFieldNode( + name: _i1.NameNode(value: 'id'), + value: _i1.VariableNode(name: _i1.NameNode(value: 'userId')), + ) + ]), + ) + ], + directives: [], + selectionSet: _i1.SelectionSetNode(selections: [ + _i1.FieldNode( + name: _i1.NameNode(value: 'totalCount'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ) + ]), + ), + _i1.FieldNode( + name: _i1.NameNode(value: 'likedUsers'), + alias: _i1.NameNode(value: 'isLiked'), + arguments: [ + _i1.ArgumentNode( + name: _i1.NameNode(value: 'where'), + value: _i1.ObjectValueNode(fields: [ + _i1.ObjectFieldNode( + name: _i1.NameNode(value: 'id'), + value: _i1.VariableNode(name: _i1.NameNode(value: 'userId')), + ) + ]), + ) + ], + directives: [], + selectionSet: _i1.SelectionSetNode(selections: [ + _i1.FieldNode( + name: _i1.NameNode(value: 'totalCount'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ) + ]), + ), + ]), +); +const Posts = _i1.OperationDefinitionNode( + type: _i1.OperationType.query, + name: _i1.NameNode(value: 'Posts'), + variableDefinitions: [ + _i1.VariableDefinitionNode( + variable: _i1.VariableNode(name: _i1.NameNode(value: 'userId')), + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'ID'), + isNonNull: true, + ), + defaultValue: _i1.DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: _i1.SelectionSetNode(selections: [ + _i1.FieldNode( + name: _i1.NameNode(value: 'posts'), + alias: null, + arguments: [ + _i1.ArgumentNode( + name: _i1.NameNode(value: 'userId'), + value: _i1.VariableNode(name: _i1.NameNode(value: 'userId')), + ) + ], + directives: [], + selectionSet: _i1.SelectionSetNode(selections: [ + _i1.FragmentSpreadNode( + name: _i1.NameNode(value: 'PostFragment'), + directives: [], + ) + ]), + ) + ]), +); +const document = _i1.DocumentNode(definitions: [ + PostFragment, + Posts, +]); diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.dart b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.dart new file mode 100644 index 00000000..10ad5bcd --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.dart @@ -0,0 +1,245 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:end_to_end_test/graphql/__generated__/serializers.gql.dart' + as _i1; + +part 'alias_var_fragment.data.gql.g.dart'; + +abstract class GPostsData implements Built { + GPostsData._(); + + factory GPostsData([Function(GPostsDataBuilder b) updates]) = _$GPostsData; + + static void _initializeBuilder(GPostsDataBuilder b) => + b..G__typename = 'Query'; + @BuiltValueField(wireName: '__typename') + String get G__typename; + BuiltList? get posts; + static Serializer get serializer => _$gPostsDataSerializer; + Map toJson() => (_i1.serializers.serializeWith( + GPostsData.serializer, + this, + ) as Map); + static GPostsData? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostsData.serializer, + json, + ); +} + +abstract class GPostsData_posts + implements Built, GPostFragment { + GPostsData_posts._(); + + factory GPostsData_posts([Function(GPostsData_postsBuilder b) updates]) = + _$GPostsData_posts; + + static void _initializeBuilder(GPostsData_postsBuilder b) => + b..G__typename = 'Post'; + @override + @BuiltValueField(wireName: '__typename') + String get G__typename; + @override + String get id; + @override + GPostsData_posts_isFavorited? get isFavorited; + @override + GPostsData_posts_isLiked? get isLiked; + static Serializer get serializer => + _$gPostsDataPostsSerializer; + @override + Map toJson() => (_i1.serializers.serializeWith( + GPostsData_posts.serializer, + this, + ) as Map); + static GPostsData_posts? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostsData_posts.serializer, + json, + ); +} + +abstract class GPostsData_posts_isFavorited + implements + Built, + GPostFragment_isFavorited { + GPostsData_posts_isFavorited._(); + + factory GPostsData_posts_isFavorited( + [Function(GPostsData_posts_isFavoritedBuilder b) updates]) = + _$GPostsData_posts_isFavorited; + + static void _initializeBuilder(GPostsData_posts_isFavoritedBuilder b) => + b..G__typename = 'PostLikes'; + @override + @BuiltValueField(wireName: '__typename') + String get G__typename; + @override + int get totalCount; + static Serializer get serializer => + _$gPostsDataPostsIsFavoritedSerializer; + @override + Map toJson() => (_i1.serializers.serializeWith( + GPostsData_posts_isFavorited.serializer, + this, + ) as Map); + static GPostsData_posts_isFavorited? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostsData_posts_isFavorited.serializer, + json, + ); +} + +abstract class GPostsData_posts_isLiked + implements + Built, + GPostFragment_isLiked { + GPostsData_posts_isLiked._(); + + factory GPostsData_posts_isLiked( + [Function(GPostsData_posts_isLikedBuilder b) updates]) = + _$GPostsData_posts_isLiked; + + static void _initializeBuilder(GPostsData_posts_isLikedBuilder b) => + b..G__typename = 'PostFavorites'; + @override + @BuiltValueField(wireName: '__typename') + String get G__typename; + @override + int get totalCount; + static Serializer get serializer => + _$gPostsDataPostsIsLikedSerializer; + @override + Map toJson() => (_i1.serializers.serializeWith( + GPostsData_posts_isLiked.serializer, + this, + ) as Map); + static GPostsData_posts_isLiked? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostsData_posts_isLiked.serializer, + json, + ); +} + +abstract class GPostFragment { + String get G__typename; + String get id; + GPostFragment_isFavorited? get isFavorited; + GPostFragment_isLiked? get isLiked; + Map toJson(); +} + +abstract class GPostFragment_isFavorited { + String get G__typename; + int get totalCount; + Map toJson(); +} + +abstract class GPostFragment_isLiked { + String get G__typename; + int get totalCount; + Map toJson(); +} + +abstract class GPostFragmentData + implements + Built, + GPostFragment { + GPostFragmentData._(); + + factory GPostFragmentData([Function(GPostFragmentDataBuilder b) updates]) = + _$GPostFragmentData; + + static void _initializeBuilder(GPostFragmentDataBuilder b) => + b..G__typename = 'Post'; + @override + @BuiltValueField(wireName: '__typename') + String get G__typename; + @override + String get id; + @override + GPostFragmentData_isFavorited? get isFavorited; + @override + GPostFragmentData_isLiked? get isLiked; + static Serializer get serializer => + _$gPostFragmentDataSerializer; + @override + Map toJson() => (_i1.serializers.serializeWith( + GPostFragmentData.serializer, + this, + ) as Map); + static GPostFragmentData? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostFragmentData.serializer, + json, + ); +} + +abstract class GPostFragmentData_isFavorited + implements + Built, + GPostFragment_isFavorited { + GPostFragmentData_isFavorited._(); + + factory GPostFragmentData_isFavorited( + [Function(GPostFragmentData_isFavoritedBuilder b) updates]) = + _$GPostFragmentData_isFavorited; + + static void _initializeBuilder(GPostFragmentData_isFavoritedBuilder b) => + b..G__typename = 'PostLikes'; + @override + @BuiltValueField(wireName: '__typename') + String get G__typename; + @override + int get totalCount; + static Serializer get serializer => + _$gPostFragmentDataIsFavoritedSerializer; + @override + Map toJson() => (_i1.serializers.serializeWith( + GPostFragmentData_isFavorited.serializer, + this, + ) as Map); + static GPostFragmentData_isFavorited? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostFragmentData_isFavorited.serializer, + json, + ); +} + +abstract class GPostFragmentData_isLiked + implements + Built, + GPostFragment_isLiked { + GPostFragmentData_isLiked._(); + + factory GPostFragmentData_isLiked( + [Function(GPostFragmentData_isLikedBuilder b) updates]) = + _$GPostFragmentData_isLiked; + + static void _initializeBuilder(GPostFragmentData_isLikedBuilder b) => + b..G__typename = 'PostFavorites'; + @override + @BuiltValueField(wireName: '__typename') + String get G__typename; + @override + int get totalCount; + static Serializer get serializer => + _$gPostFragmentDataIsLikedSerializer; + @override + Map toJson() => (_i1.serializers.serializeWith( + GPostFragmentData_isLiked.serializer, + this, + ) as Map); + static GPostFragmentData_isLiked? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostFragmentData_isLiked.serializer, + json, + ); +} diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.g.dart b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.g.dart new file mode 100644 index 00000000..bdd60526 --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.g.dart @@ -0,0 +1,1272 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'alias_var_fragment.data.gql.dart'; + +// ************************************************************************** +// BuiltValueGenerator +// ************************************************************************** + +Serializer _$gPostsDataSerializer = new _$GPostsDataSerializer(); +Serializer _$gPostsDataPostsSerializer = + new _$GPostsData_postsSerializer(); +Serializer + _$gPostsDataPostsIsFavoritedSerializer = + new _$GPostsData_posts_isFavoritedSerializer(); +Serializer _$gPostsDataPostsIsLikedSerializer = + new _$GPostsData_posts_isLikedSerializer(); +Serializer _$gPostFragmentDataSerializer = + new _$GPostFragmentDataSerializer(); +Serializer + _$gPostFragmentDataIsFavoritedSerializer = + new _$GPostFragmentData_isFavoritedSerializer(); +Serializer _$gPostFragmentDataIsLikedSerializer = + new _$GPostFragmentData_isLikedSerializer(); + +class _$GPostsDataSerializer implements StructuredSerializer { + @override + final Iterable types = const [GPostsData, _$GPostsData]; + @override + final String wireName = 'GPostsData'; + + @override + Iterable serialize(Serializers serializers, GPostsData object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + '__typename', + serializers.serialize(object.G__typename, + specifiedType: const FullType(String)), + ]; + Object? value; + value = object.posts; + if (value != null) { + result + ..add('posts') + ..add(serializers.serialize(value, + specifiedType: const FullType( + BuiltList, const [const FullType.nullable(GPostsData_posts)]))); + } + return result; + } + + @override + GPostsData deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostsDataBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case '__typename': + result.G__typename = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'posts': + result.posts.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltList, const [ + const FullType.nullable(GPostsData_posts) + ]))! as BuiltList); + break; + } + } + + return result.build(); + } +} + +class _$GPostsData_postsSerializer + implements StructuredSerializer { + @override + final Iterable types = const [GPostsData_posts, _$GPostsData_posts]; + @override + final String wireName = 'GPostsData_posts'; + + @override + Iterable serialize(Serializers serializers, GPostsData_posts object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + '__typename', + serializers.serialize(object.G__typename, + specifiedType: const FullType(String)), + 'id', + serializers.serialize(object.id, specifiedType: const FullType(String)), + ]; + Object? value; + value = object.isFavorited; + if (value != null) { + result + ..add('isFavorited') + ..add(serializers.serialize(value, + specifiedType: const FullType(GPostsData_posts_isFavorited))); + } + value = object.isLiked; + if (value != null) { + result + ..add('isLiked') + ..add(serializers.serialize(value, + specifiedType: const FullType(GPostsData_posts_isLiked))); + } + return result; + } + + @override + GPostsData_posts deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostsData_postsBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case '__typename': + result.G__typename = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'id': + result.id = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'isFavorited': + result.isFavorited.replace(serializers.deserialize(value, + specifiedType: const FullType(GPostsData_posts_isFavorited))! + as GPostsData_posts_isFavorited); + break; + case 'isLiked': + result.isLiked.replace(serializers.deserialize(value, + specifiedType: const FullType(GPostsData_posts_isLiked))! + as GPostsData_posts_isLiked); + break; + } + } + + return result.build(); + } +} + +class _$GPostsData_posts_isFavoritedSerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + GPostsData_posts_isFavorited, + _$GPostsData_posts_isFavorited + ]; + @override + final String wireName = 'GPostsData_posts_isFavorited'; + + @override + Iterable serialize( + Serializers serializers, GPostsData_posts_isFavorited object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + '__typename', + serializers.serialize(object.G__typename, + specifiedType: const FullType(String)), + 'totalCount', + serializers.serialize(object.totalCount, + specifiedType: const FullType(int)), + ]; + + return result; + } + + @override + GPostsData_posts_isFavorited deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostsData_posts_isFavoritedBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case '__typename': + result.G__typename = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'totalCount': + result.totalCount = serializers.deserialize(value, + specifiedType: const FullType(int))! as int; + break; + } + } + + return result.build(); + } +} + +class _$GPostsData_posts_isLikedSerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + GPostsData_posts_isLiked, + _$GPostsData_posts_isLiked + ]; + @override + final String wireName = 'GPostsData_posts_isLiked'; + + @override + Iterable serialize( + Serializers serializers, GPostsData_posts_isLiked object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + '__typename', + serializers.serialize(object.G__typename, + specifiedType: const FullType(String)), + 'totalCount', + serializers.serialize(object.totalCount, + specifiedType: const FullType(int)), + ]; + + return result; + } + + @override + GPostsData_posts_isLiked deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostsData_posts_isLikedBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case '__typename': + result.G__typename = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'totalCount': + result.totalCount = serializers.deserialize(value, + specifiedType: const FullType(int))! as int; + break; + } + } + + return result.build(); + } +} + +class _$GPostFragmentDataSerializer + implements StructuredSerializer { + @override + final Iterable types = const [GPostFragmentData, _$GPostFragmentData]; + @override + final String wireName = 'GPostFragmentData'; + + @override + Iterable serialize(Serializers serializers, GPostFragmentData object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + '__typename', + serializers.serialize(object.G__typename, + specifiedType: const FullType(String)), + 'id', + serializers.serialize(object.id, specifiedType: const FullType(String)), + ]; + Object? value; + value = object.isFavorited; + if (value != null) { + result + ..add('isFavorited') + ..add(serializers.serialize(value, + specifiedType: const FullType(GPostFragmentData_isFavorited))); + } + value = object.isLiked; + if (value != null) { + result + ..add('isLiked') + ..add(serializers.serialize(value, + specifiedType: const FullType(GPostFragmentData_isLiked))); + } + return result; + } + + @override + GPostFragmentData deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostFragmentDataBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case '__typename': + result.G__typename = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'id': + result.id = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'isFavorited': + result.isFavorited.replace(serializers.deserialize(value, + specifiedType: const FullType(GPostFragmentData_isFavorited))! + as GPostFragmentData_isFavorited); + break; + case 'isLiked': + result.isLiked.replace(serializers.deserialize(value, + specifiedType: const FullType(GPostFragmentData_isLiked))! + as GPostFragmentData_isLiked); + break; + } + } + + return result.build(); + } +} + +class _$GPostFragmentData_isFavoritedSerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + GPostFragmentData_isFavorited, + _$GPostFragmentData_isFavorited + ]; + @override + final String wireName = 'GPostFragmentData_isFavorited'; + + @override + Iterable serialize( + Serializers serializers, GPostFragmentData_isFavorited object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + '__typename', + serializers.serialize(object.G__typename, + specifiedType: const FullType(String)), + 'totalCount', + serializers.serialize(object.totalCount, + specifiedType: const FullType(int)), + ]; + + return result; + } + + @override + GPostFragmentData_isFavorited deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostFragmentData_isFavoritedBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case '__typename': + result.G__typename = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'totalCount': + result.totalCount = serializers.deserialize(value, + specifiedType: const FullType(int))! as int; + break; + } + } + + return result.build(); + } +} + +class _$GPostFragmentData_isLikedSerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + GPostFragmentData_isLiked, + _$GPostFragmentData_isLiked + ]; + @override + final String wireName = 'GPostFragmentData_isLiked'; + + @override + Iterable serialize( + Serializers serializers, GPostFragmentData_isLiked object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + '__typename', + serializers.serialize(object.G__typename, + specifiedType: const FullType(String)), + 'totalCount', + serializers.serialize(object.totalCount, + specifiedType: const FullType(int)), + ]; + + return result; + } + + @override + GPostFragmentData_isLiked deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostFragmentData_isLikedBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case '__typename': + result.G__typename = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'totalCount': + result.totalCount = serializers.deserialize(value, + specifiedType: const FullType(int))! as int; + break; + } + } + + return result.build(); + } +} + +class _$GPostsData extends GPostsData { + @override + final String G__typename; + @override + final BuiltList? posts; + + factory _$GPostsData([void Function(GPostsDataBuilder)? updates]) => + (new GPostsDataBuilder()..update(updates))._build(); + + _$GPostsData._({required this.G__typename, this.posts}) : super._() { + BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData', 'G__typename'); + } + + @override + GPostsData rebuild(void Function(GPostsDataBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostsDataBuilder toBuilder() => new GPostsDataBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostsData && + G__typename == other.G__typename && + posts == other.posts; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, posts.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostsData') + ..add('G__typename', G__typename) + ..add('posts', posts)) + .toString(); + } +} + +class GPostsDataBuilder implements Builder { + _$GPostsData? _$v; + + String? _G__typename; + String? get G__typename => _$this._G__typename; + set G__typename(String? G__typename) => _$this._G__typename = G__typename; + + ListBuilder? _posts; + ListBuilder get posts => + _$this._posts ??= new ListBuilder(); + set posts(ListBuilder? posts) => _$this._posts = posts; + + GPostsDataBuilder() { + GPostsData._initializeBuilder(this); + } + + GPostsDataBuilder get _$this { + final $v = _$v; + if ($v != null) { + _G__typename = $v.G__typename; + _posts = $v.posts?.toBuilder(); + _$v = null; + } + return this; + } + + @override + void replace(GPostsData other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostsData; + } + + @override + void update(void Function(GPostsDataBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostsData build() => _build(); + + _$GPostsData _build() { + _$GPostsData _$result; + try { + _$result = _$v ?? + new _$GPostsData._( + G__typename: BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData', 'G__typename'), + posts: _posts?.build()); + } catch (_) { + late String _$failedField; + try { + _$failedField = 'posts'; + _posts?.build(); + } catch (e) { + throw new BuiltValueNestedFieldError( + r'GPostsData', _$failedField, e.toString()); + } + rethrow; + } + replace(_$result); + return _$result; + } +} + +class _$GPostsData_posts extends GPostsData_posts { + @override + final String G__typename; + @override + final String id; + @override + final GPostsData_posts_isFavorited? isFavorited; + @override + final GPostsData_posts_isLiked? isLiked; + + factory _$GPostsData_posts( + [void Function(GPostsData_postsBuilder)? updates]) => + (new GPostsData_postsBuilder()..update(updates))._build(); + + _$GPostsData_posts._( + {required this.G__typename, + required this.id, + this.isFavorited, + this.isLiked}) + : super._() { + BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData_posts', 'G__typename'); + BuiltValueNullFieldError.checkNotNull(id, r'GPostsData_posts', 'id'); + } + + @override + GPostsData_posts rebuild(void Function(GPostsData_postsBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostsData_postsBuilder toBuilder() => + new GPostsData_postsBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostsData_posts && + G__typename == other.G__typename && + id == other.id && + isFavorited == other.isFavorited && + isLiked == other.isLiked; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, isFavorited.hashCode); + _$hash = $jc(_$hash, isLiked.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostsData_posts') + ..add('G__typename', G__typename) + ..add('id', id) + ..add('isFavorited', isFavorited) + ..add('isLiked', isLiked)) + .toString(); + } +} + +class GPostsData_postsBuilder + implements Builder { + _$GPostsData_posts? _$v; + + String? _G__typename; + String? get G__typename => _$this._G__typename; + set G__typename(String? G__typename) => _$this._G__typename = G__typename; + + String? _id; + String? get id => _$this._id; + set id(String? id) => _$this._id = id; + + GPostsData_posts_isFavoritedBuilder? _isFavorited; + GPostsData_posts_isFavoritedBuilder get isFavorited => + _$this._isFavorited ??= new GPostsData_posts_isFavoritedBuilder(); + set isFavorited(GPostsData_posts_isFavoritedBuilder? isFavorited) => + _$this._isFavorited = isFavorited; + + GPostsData_posts_isLikedBuilder? _isLiked; + GPostsData_posts_isLikedBuilder get isLiked => + _$this._isLiked ??= new GPostsData_posts_isLikedBuilder(); + set isLiked(GPostsData_posts_isLikedBuilder? isLiked) => + _$this._isLiked = isLiked; + + GPostsData_postsBuilder() { + GPostsData_posts._initializeBuilder(this); + } + + GPostsData_postsBuilder get _$this { + final $v = _$v; + if ($v != null) { + _G__typename = $v.G__typename; + _id = $v.id; + _isFavorited = $v.isFavorited?.toBuilder(); + _isLiked = $v.isLiked?.toBuilder(); + _$v = null; + } + return this; + } + + @override + void replace(GPostsData_posts other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostsData_posts; + } + + @override + void update(void Function(GPostsData_postsBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostsData_posts build() => _build(); + + _$GPostsData_posts _build() { + _$GPostsData_posts _$result; + try { + _$result = _$v ?? + new _$GPostsData_posts._( + G__typename: BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData_posts', 'G__typename'), + id: BuiltValueNullFieldError.checkNotNull( + id, r'GPostsData_posts', 'id'), + isFavorited: _isFavorited?.build(), + isLiked: _isLiked?.build()); + } catch (_) { + late String _$failedField; + try { + _$failedField = 'isFavorited'; + _isFavorited?.build(); + _$failedField = 'isLiked'; + _isLiked?.build(); + } catch (e) { + throw new BuiltValueNestedFieldError( + r'GPostsData_posts', _$failedField, e.toString()); + } + rethrow; + } + replace(_$result); + return _$result; + } +} + +class _$GPostsData_posts_isFavorited extends GPostsData_posts_isFavorited { + @override + final String G__typename; + @override + final int totalCount; + + factory _$GPostsData_posts_isFavorited( + [void Function(GPostsData_posts_isFavoritedBuilder)? updates]) => + (new GPostsData_posts_isFavoritedBuilder()..update(updates))._build(); + + _$GPostsData_posts_isFavorited._( + {required this.G__typename, required this.totalCount}) + : super._() { + BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData_posts_isFavorited', 'G__typename'); + BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostsData_posts_isFavorited', 'totalCount'); + } + + @override + GPostsData_posts_isFavorited rebuild( + void Function(GPostsData_posts_isFavoritedBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostsData_posts_isFavoritedBuilder toBuilder() => + new GPostsData_posts_isFavoritedBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostsData_posts_isFavorited && + G__typename == other.G__typename && + totalCount == other.totalCount; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, totalCount.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostsData_posts_isFavorited') + ..add('G__typename', G__typename) + ..add('totalCount', totalCount)) + .toString(); + } +} + +class GPostsData_posts_isFavoritedBuilder + implements + Builder { + _$GPostsData_posts_isFavorited? _$v; + + String? _G__typename; + String? get G__typename => _$this._G__typename; + set G__typename(String? G__typename) => _$this._G__typename = G__typename; + + int? _totalCount; + int? get totalCount => _$this._totalCount; + set totalCount(int? totalCount) => _$this._totalCount = totalCount; + + GPostsData_posts_isFavoritedBuilder() { + GPostsData_posts_isFavorited._initializeBuilder(this); + } + + GPostsData_posts_isFavoritedBuilder get _$this { + final $v = _$v; + if ($v != null) { + _G__typename = $v.G__typename; + _totalCount = $v.totalCount; + _$v = null; + } + return this; + } + + @override + void replace(GPostsData_posts_isFavorited other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostsData_posts_isFavorited; + } + + @override + void update(void Function(GPostsData_posts_isFavoritedBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostsData_posts_isFavorited build() => _build(); + + _$GPostsData_posts_isFavorited _build() { + final _$result = _$v ?? + new _$GPostsData_posts_isFavorited._( + G__typename: BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData_posts_isFavorited', 'G__typename'), + totalCount: BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostsData_posts_isFavorited', 'totalCount')); + replace(_$result); + return _$result; + } +} + +class _$GPostsData_posts_isLiked extends GPostsData_posts_isLiked { + @override + final String G__typename; + @override + final int totalCount; + + factory _$GPostsData_posts_isLiked( + [void Function(GPostsData_posts_isLikedBuilder)? updates]) => + (new GPostsData_posts_isLikedBuilder()..update(updates))._build(); + + _$GPostsData_posts_isLiked._( + {required this.G__typename, required this.totalCount}) + : super._() { + BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData_posts_isLiked', 'G__typename'); + BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostsData_posts_isLiked', 'totalCount'); + } + + @override + GPostsData_posts_isLiked rebuild( + void Function(GPostsData_posts_isLikedBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostsData_posts_isLikedBuilder toBuilder() => + new GPostsData_posts_isLikedBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostsData_posts_isLiked && + G__typename == other.G__typename && + totalCount == other.totalCount; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, totalCount.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostsData_posts_isLiked') + ..add('G__typename', G__typename) + ..add('totalCount', totalCount)) + .toString(); + } +} + +class GPostsData_posts_isLikedBuilder + implements + Builder { + _$GPostsData_posts_isLiked? _$v; + + String? _G__typename; + String? get G__typename => _$this._G__typename; + set G__typename(String? G__typename) => _$this._G__typename = G__typename; + + int? _totalCount; + int? get totalCount => _$this._totalCount; + set totalCount(int? totalCount) => _$this._totalCount = totalCount; + + GPostsData_posts_isLikedBuilder() { + GPostsData_posts_isLiked._initializeBuilder(this); + } + + GPostsData_posts_isLikedBuilder get _$this { + final $v = _$v; + if ($v != null) { + _G__typename = $v.G__typename; + _totalCount = $v.totalCount; + _$v = null; + } + return this; + } + + @override + void replace(GPostsData_posts_isLiked other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostsData_posts_isLiked; + } + + @override + void update(void Function(GPostsData_posts_isLikedBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostsData_posts_isLiked build() => _build(); + + _$GPostsData_posts_isLiked _build() { + final _$result = _$v ?? + new _$GPostsData_posts_isLiked._( + G__typename: BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData_posts_isLiked', 'G__typename'), + totalCount: BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostsData_posts_isLiked', 'totalCount')); + replace(_$result); + return _$result; + } +} + +class _$GPostFragmentData extends GPostFragmentData { + @override + final String G__typename; + @override + final String id; + @override + final GPostFragmentData_isFavorited? isFavorited; + @override + final GPostFragmentData_isLiked? isLiked; + + factory _$GPostFragmentData( + [void Function(GPostFragmentDataBuilder)? updates]) => + (new GPostFragmentDataBuilder()..update(updates))._build(); + + _$GPostFragmentData._( + {required this.G__typename, + required this.id, + this.isFavorited, + this.isLiked}) + : super._() { + BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostFragmentData', 'G__typename'); + BuiltValueNullFieldError.checkNotNull(id, r'GPostFragmentData', 'id'); + } + + @override + GPostFragmentData rebuild(void Function(GPostFragmentDataBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostFragmentDataBuilder toBuilder() => + new GPostFragmentDataBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostFragmentData && + G__typename == other.G__typename && + id == other.id && + isFavorited == other.isFavorited && + isLiked == other.isLiked; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, isFavorited.hashCode); + _$hash = $jc(_$hash, isLiked.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostFragmentData') + ..add('G__typename', G__typename) + ..add('id', id) + ..add('isFavorited', isFavorited) + ..add('isLiked', isLiked)) + .toString(); + } +} + +class GPostFragmentDataBuilder + implements Builder { + _$GPostFragmentData? _$v; + + String? _G__typename; + String? get G__typename => _$this._G__typename; + set G__typename(String? G__typename) => _$this._G__typename = G__typename; + + String? _id; + String? get id => _$this._id; + set id(String? id) => _$this._id = id; + + GPostFragmentData_isFavoritedBuilder? _isFavorited; + GPostFragmentData_isFavoritedBuilder get isFavorited => + _$this._isFavorited ??= new GPostFragmentData_isFavoritedBuilder(); + set isFavorited(GPostFragmentData_isFavoritedBuilder? isFavorited) => + _$this._isFavorited = isFavorited; + + GPostFragmentData_isLikedBuilder? _isLiked; + GPostFragmentData_isLikedBuilder get isLiked => + _$this._isLiked ??= new GPostFragmentData_isLikedBuilder(); + set isLiked(GPostFragmentData_isLikedBuilder? isLiked) => + _$this._isLiked = isLiked; + + GPostFragmentDataBuilder() { + GPostFragmentData._initializeBuilder(this); + } + + GPostFragmentDataBuilder get _$this { + final $v = _$v; + if ($v != null) { + _G__typename = $v.G__typename; + _id = $v.id; + _isFavorited = $v.isFavorited?.toBuilder(); + _isLiked = $v.isLiked?.toBuilder(); + _$v = null; + } + return this; + } + + @override + void replace(GPostFragmentData other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostFragmentData; + } + + @override + void update(void Function(GPostFragmentDataBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostFragmentData build() => _build(); + + _$GPostFragmentData _build() { + _$GPostFragmentData _$result; + try { + _$result = _$v ?? + new _$GPostFragmentData._( + G__typename: BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostFragmentData', 'G__typename'), + id: BuiltValueNullFieldError.checkNotNull( + id, r'GPostFragmentData', 'id'), + isFavorited: _isFavorited?.build(), + isLiked: _isLiked?.build()); + } catch (_) { + late String _$failedField; + try { + _$failedField = 'isFavorited'; + _isFavorited?.build(); + _$failedField = 'isLiked'; + _isLiked?.build(); + } catch (e) { + throw new BuiltValueNestedFieldError( + r'GPostFragmentData', _$failedField, e.toString()); + } + rethrow; + } + replace(_$result); + return _$result; + } +} + +class _$GPostFragmentData_isFavorited extends GPostFragmentData_isFavorited { + @override + final String G__typename; + @override + final int totalCount; + + factory _$GPostFragmentData_isFavorited( + [void Function(GPostFragmentData_isFavoritedBuilder)? updates]) => + (new GPostFragmentData_isFavoritedBuilder()..update(updates))._build(); + + _$GPostFragmentData_isFavorited._( + {required this.G__typename, required this.totalCount}) + : super._() { + BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostFragmentData_isFavorited', 'G__typename'); + BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostFragmentData_isFavorited', 'totalCount'); + } + + @override + GPostFragmentData_isFavorited rebuild( + void Function(GPostFragmentData_isFavoritedBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostFragmentData_isFavoritedBuilder toBuilder() => + new GPostFragmentData_isFavoritedBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostFragmentData_isFavorited && + G__typename == other.G__typename && + totalCount == other.totalCount; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, totalCount.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostFragmentData_isFavorited') + ..add('G__typename', G__typename) + ..add('totalCount', totalCount)) + .toString(); + } +} + +class GPostFragmentData_isFavoritedBuilder + implements + Builder { + _$GPostFragmentData_isFavorited? _$v; + + String? _G__typename; + String? get G__typename => _$this._G__typename; + set G__typename(String? G__typename) => _$this._G__typename = G__typename; + + int? _totalCount; + int? get totalCount => _$this._totalCount; + set totalCount(int? totalCount) => _$this._totalCount = totalCount; + + GPostFragmentData_isFavoritedBuilder() { + GPostFragmentData_isFavorited._initializeBuilder(this); + } + + GPostFragmentData_isFavoritedBuilder get _$this { + final $v = _$v; + if ($v != null) { + _G__typename = $v.G__typename; + _totalCount = $v.totalCount; + _$v = null; + } + return this; + } + + @override + void replace(GPostFragmentData_isFavorited other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostFragmentData_isFavorited; + } + + @override + void update(void Function(GPostFragmentData_isFavoritedBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostFragmentData_isFavorited build() => _build(); + + _$GPostFragmentData_isFavorited _build() { + final _$result = _$v ?? + new _$GPostFragmentData_isFavorited._( + G__typename: BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostFragmentData_isFavorited', 'G__typename'), + totalCount: BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostFragmentData_isFavorited', 'totalCount')); + replace(_$result); + return _$result; + } +} + +class _$GPostFragmentData_isLiked extends GPostFragmentData_isLiked { + @override + final String G__typename; + @override + final int totalCount; + + factory _$GPostFragmentData_isLiked( + [void Function(GPostFragmentData_isLikedBuilder)? updates]) => + (new GPostFragmentData_isLikedBuilder()..update(updates))._build(); + + _$GPostFragmentData_isLiked._( + {required this.G__typename, required this.totalCount}) + : super._() { + BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostFragmentData_isLiked', 'G__typename'); + BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostFragmentData_isLiked', 'totalCount'); + } + + @override + GPostFragmentData_isLiked rebuild( + void Function(GPostFragmentData_isLikedBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostFragmentData_isLikedBuilder toBuilder() => + new GPostFragmentData_isLikedBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostFragmentData_isLiked && + G__typename == other.G__typename && + totalCount == other.totalCount; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, totalCount.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostFragmentData_isLiked') + ..add('G__typename', G__typename) + ..add('totalCount', totalCount)) + .toString(); + } +} + +class GPostFragmentData_isLikedBuilder + implements + Builder { + _$GPostFragmentData_isLiked? _$v; + + String? _G__typename; + String? get G__typename => _$this._G__typename; + set G__typename(String? G__typename) => _$this._G__typename = G__typename; + + int? _totalCount; + int? get totalCount => _$this._totalCount; + set totalCount(int? totalCount) => _$this._totalCount = totalCount; + + GPostFragmentData_isLikedBuilder() { + GPostFragmentData_isLiked._initializeBuilder(this); + } + + GPostFragmentData_isLikedBuilder get _$this { + final $v = _$v; + if ($v != null) { + _G__typename = $v.G__typename; + _totalCount = $v.totalCount; + _$v = null; + } + return this; + } + + @override + void replace(GPostFragmentData_isLiked other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostFragmentData_isLiked; + } + + @override + void update(void Function(GPostFragmentData_isLikedBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostFragmentData_isLiked build() => _build(); + + _$GPostFragmentData_isLiked _build() { + final _$result = _$v ?? + new _$GPostFragmentData_isLiked._( + G__typename: BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostFragmentData_isLiked', 'G__typename'), + totalCount: BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostFragmentData_isLiked', 'totalCount')); + replace(_$result); + return _$result; + } +} + +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.dart b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.dart new file mode 100644 index 00000000..c759b717 --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:end_to_end_test/aliases/__generated__/alias_var_fragment.ast.gql.dart' + as _i2; +import 'package:end_to_end_test/aliases/__generated__/alias_var_fragment.var.gql.dart' + as _i3; +import 'package:end_to_end_test/graphql/__generated__/serializers.gql.dart' + as _i4; +import 'package:gql_exec/gql_exec.dart' as _i1; + +part 'alias_var_fragment.req.gql.g.dart'; + +abstract class GPosts implements Built { + GPosts._(); + + factory GPosts([Function(GPostsBuilder b) updates]) = _$GPosts; + + static void _initializeBuilder(GPostsBuilder b) => b + ..operation = _i1.Operation( + document: _i2.document, + operationName: 'Posts', + ); + _i3.GPostsVars get vars; + _i1.Operation get operation; + static Serializer get serializer => _$gPostsSerializer; + Map toJson() => (_i4.serializers.serializeWith( + GPosts.serializer, + this, + ) as Map); + static GPosts? fromJson(Map json) => + _i4.serializers.deserializeWith( + GPosts.serializer, + json, + ); +} diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.g.dart b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.g.dart new file mode 100644 index 00000000..0f8996ec --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.g.dart @@ -0,0 +1,170 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'alias_var_fragment.req.gql.dart'; + +// ************************************************************************** +// BuiltValueGenerator +// ************************************************************************** + +Serializer _$gPostsSerializer = new _$GPostsSerializer(); + +class _$GPostsSerializer implements StructuredSerializer { + @override + final Iterable types = const [GPosts, _$GPosts]; + @override + final String wireName = 'GPosts'; + + @override + Iterable serialize(Serializers serializers, GPosts object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + 'vars', + serializers.serialize(object.vars, + specifiedType: const FullType(_i3.GPostsVars)), + 'operation', + serializers.serialize(object.operation, + specifiedType: const FullType(_i1.Operation)), + ]; + + return result; + } + + @override + GPosts deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostsBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case 'vars': + result.vars.replace(serializers.deserialize(value, + specifiedType: const FullType(_i3.GPostsVars))! + as _i3.GPostsVars); + break; + case 'operation': + result.operation = serializers.deserialize(value, + specifiedType: const FullType(_i1.Operation))! as _i1.Operation; + break; + } + } + + return result.build(); + } +} + +class _$GPosts extends GPosts { + @override + final _i3.GPostsVars vars; + @override + final _i1.Operation operation; + + factory _$GPosts([void Function(GPostsBuilder)? updates]) => + (new GPostsBuilder()..update(updates))._build(); + + _$GPosts._({required this.vars, required this.operation}) : super._() { + BuiltValueNullFieldError.checkNotNull(vars, r'GPosts', 'vars'); + BuiltValueNullFieldError.checkNotNull(operation, r'GPosts', 'operation'); + } + + @override + GPosts rebuild(void Function(GPostsBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostsBuilder toBuilder() => new GPostsBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPosts && + vars == other.vars && + operation == other.operation; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPosts') + ..add('vars', vars) + ..add('operation', operation)) + .toString(); + } +} + +class GPostsBuilder implements Builder { + _$GPosts? _$v; + + _i3.GPostsVarsBuilder? _vars; + _i3.GPostsVarsBuilder get vars => + _$this._vars ??= new _i3.GPostsVarsBuilder(); + set vars(_i3.GPostsVarsBuilder? vars) => _$this._vars = vars; + + _i1.Operation? _operation; + _i1.Operation? get operation => _$this._operation; + set operation(_i1.Operation? operation) => _$this._operation = operation; + + GPostsBuilder() { + GPosts._initializeBuilder(this); + } + + GPostsBuilder get _$this { + final $v = _$v; + if ($v != null) { + _vars = $v.vars.toBuilder(); + _operation = $v.operation; + _$v = null; + } + return this; + } + + @override + void replace(GPosts other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPosts; + } + + @override + void update(void Function(GPostsBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPosts build() => _build(); + + _$GPosts _build() { + _$GPosts _$result; + try { + _$result = _$v ?? + new _$GPosts._( + vars: vars.build(), + operation: BuiltValueNullFieldError.checkNotNull( + operation, r'GPosts', 'operation')); + } catch (_) { + late String _$failedField; + try { + _$failedField = 'vars'; + vars.build(); + } catch (e) { + throw new BuiltValueNestedFieldError( + r'GPosts', _$failedField, e.toString()); + } + rethrow; + } + replace(_$result); + return _$result; + } +} + +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.dart b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.dart new file mode 100644 index 00000000..b6b8a678 --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.dart @@ -0,0 +1,49 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:end_to_end_test/graphql/__generated__/serializers.gql.dart' + as _i1; + +part 'alias_var_fragment.var.gql.g.dart'; + +abstract class GPostsVars implements Built { + GPostsVars._(); + + factory GPostsVars([Function(GPostsVarsBuilder b) updates]) = _$GPostsVars; + + String get userId; + static Serializer get serializer => _$gPostsVarsSerializer; + Map toJson() => (_i1.serializers.serializeWith( + GPostsVars.serializer, + this, + ) as Map); + static GPostsVars? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostsVars.serializer, + json, + ); +} + +abstract class GPostFragmentVars + implements Built { + GPostFragmentVars._(); + + factory GPostFragmentVars([Function(GPostFragmentVarsBuilder b) updates]) = + _$GPostFragmentVars; + + String get userId; + static Serializer get serializer => + _$gPostFragmentVarsSerializer; + Map toJson() => (_i1.serializers.serializeWith( + GPostFragmentVars.serializer, + this, + ) as Map); + static GPostFragmentVars? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostFragmentVars.serializer, + json, + ); +} diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.g.dart b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.g.dart new file mode 100644 index 00000000..5a3b87ac --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.g.dart @@ -0,0 +1,262 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'alias_var_fragment.var.gql.dart'; + +// ************************************************************************** +// BuiltValueGenerator +// ************************************************************************** + +Serializer _$gPostsVarsSerializer = new _$GPostsVarsSerializer(); +Serializer _$gPostFragmentVarsSerializer = + new _$GPostFragmentVarsSerializer(); + +class _$GPostsVarsSerializer implements StructuredSerializer { + @override + final Iterable types = const [GPostsVars, _$GPostsVars]; + @override + final String wireName = 'GPostsVars'; + + @override + Iterable serialize(Serializers serializers, GPostsVars object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + 'userId', + serializers.serialize(object.userId, + specifiedType: const FullType(String)), + ]; + + return result; + } + + @override + GPostsVars deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostsVarsBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case 'userId': + result.userId = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + } + } + + return result.build(); + } +} + +class _$GPostFragmentVarsSerializer + implements StructuredSerializer { + @override + final Iterable types = const [GPostFragmentVars, _$GPostFragmentVars]; + @override + final String wireName = 'GPostFragmentVars'; + + @override + Iterable serialize(Serializers serializers, GPostFragmentVars object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + 'userId', + serializers.serialize(object.userId, + specifiedType: const FullType(String)), + ]; + + return result; + } + + @override + GPostFragmentVars deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostFragmentVarsBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case 'userId': + result.userId = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + } + } + + return result.build(); + } +} + +class _$GPostsVars extends GPostsVars { + @override + final String userId; + + factory _$GPostsVars([void Function(GPostsVarsBuilder)? updates]) => + (new GPostsVarsBuilder()..update(updates))._build(); + + _$GPostsVars._({required this.userId}) : super._() { + BuiltValueNullFieldError.checkNotNull(userId, r'GPostsVars', 'userId'); + } + + @override + GPostsVars rebuild(void Function(GPostsVarsBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostsVarsBuilder toBuilder() => new GPostsVarsBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostsVars && userId == other.userId; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, userId.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostsVars')..add('userId', userId)) + .toString(); + } +} + +class GPostsVarsBuilder implements Builder { + _$GPostsVars? _$v; + + String? _userId; + String? get userId => _$this._userId; + set userId(String? userId) => _$this._userId = userId; + + GPostsVarsBuilder(); + + GPostsVarsBuilder get _$this { + final $v = _$v; + if ($v != null) { + _userId = $v.userId; + _$v = null; + } + return this; + } + + @override + void replace(GPostsVars other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostsVars; + } + + @override + void update(void Function(GPostsVarsBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostsVars build() => _build(); + + _$GPostsVars _build() { + final _$result = _$v ?? + new _$GPostsVars._( + userId: BuiltValueNullFieldError.checkNotNull( + userId, r'GPostsVars', 'userId')); + replace(_$result); + return _$result; + } +} + +class _$GPostFragmentVars extends GPostFragmentVars { + @override + final String userId; + + factory _$GPostFragmentVars( + [void Function(GPostFragmentVarsBuilder)? updates]) => + (new GPostFragmentVarsBuilder()..update(updates))._build(); + + _$GPostFragmentVars._({required this.userId}) : super._() { + BuiltValueNullFieldError.checkNotNull( + userId, r'GPostFragmentVars', 'userId'); + } + + @override + GPostFragmentVars rebuild(void Function(GPostFragmentVarsBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostFragmentVarsBuilder toBuilder() => + new GPostFragmentVarsBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostFragmentVars && userId == other.userId; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, userId.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostFragmentVars') + ..add('userId', userId)) + .toString(); + } +} + +class GPostFragmentVarsBuilder + implements Builder { + _$GPostFragmentVars? _$v; + + String? _userId; + String? get userId => _$this._userId; + set userId(String? userId) => _$this._userId = userId; + + GPostFragmentVarsBuilder(); + + GPostFragmentVarsBuilder get _$this { + final $v = _$v; + if ($v != null) { + _userId = $v.userId; + _$v = null; + } + return this; + } + + @override + void replace(GPostFragmentVars other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostFragmentVars; + } + + @override + void update(void Function(GPostFragmentVarsBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostFragmentVars build() => _build(); + + _$GPostFragmentVars _build() { + final _$result = _$v ?? + new _$GPostFragmentVars._( + userId: BuiltValueNullFieldError.checkNotNull( + userId, r'GPostFragmentVars', 'userId')); + replace(_$result); + return _$result; + } +} + +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.data.gql.g.dart b/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.data.gql.g.dart index ed85bfb5..6d82d8a2 100644 --- a/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.data.gql.g.dart @@ -253,8 +253,12 @@ class _$GAliasedHeroData extends GAliasedHeroData { @override int get hashCode { - return $jf($jc($jc($jc(0, G__typename.hashCode), empireHero.hashCode), - jediHero.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, empireHero.hashCode); + _$hash = $jc(_$hash, jediHero.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -394,9 +398,13 @@ class _$GAliasedHeroData_empireHero extends GAliasedHeroData_empireHero { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - from.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, from.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -542,9 +550,13 @@ class _$GAliasedHeroData_jediHero extends GAliasedHeroData_jediHero { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - from.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, from.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -638,4 +650,4 @@ class GAliasedHeroData_jediHeroBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.req.gql.g.dart b/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.req.gql.g.dart index 34ca12f5..3c44d30b 100644 --- a/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.req.gql.g.dart @@ -90,7 +90,11 @@ class _$GAliasedHero extends GAliasedHero { @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -167,4 +171,4 @@ class GAliasedHeroBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.var.gql.g.dart b/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.var.gql.g.dart index f40c47cc..89fe20ab 100644 --- a/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.var.gql.g.dart @@ -79,7 +79,10 @@ class _$GAliasedHeroVars extends GAliasedHeroVars { @override int get hashCode { - return $jf($jc(0, ep.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, ep.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -132,4 +135,4 @@ class GAliasedHeroVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql b/codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql new file mode 100644 index 00000000..52e41f29 --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql @@ -0,0 +1,15 @@ +fragment PostFragment on Post { + id + isFavorited: favoritedUsers(where: {id: $userId}){ + totalCount + } + isLiked: likedUsers(where: {id: $userId}){ + totalCount + } +} + +query Posts($userId: ID!) { + posts(userId: $userId) { + ...PostFragment + } +} \ No newline at end of file diff --git a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.data.gql.g.dart b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.data.gql.g.dart index 405b7551..b5005f79 100644 --- a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.data.gql.g.dart @@ -691,7 +691,11 @@ class _$GHeroWithFragmentsData extends GHeroWithFragmentsData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), hero.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, hero.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -819,10 +823,13 @@ class _$GHeroWithFragmentsData_hero extends GHeroWithFragmentsData_hero { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), - friendsConnection.hashCode), - name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, friendsConnection.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -965,8 +972,12 @@ class _$GHeroWithFragmentsData_hero_friendsConnection @override int get hashCode { - return $jf($jc($jc($jc(0, G__typename.hashCode), totalCount.hashCode), - edges.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, totalCount.hashCode); + _$hash = $jc(_$hash, edges.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1108,7 +1119,11 @@ class _$GHeroWithFragmentsData_hero_friendsConnection_edges @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), node.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, node.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1247,7 +1262,11 @@ class _$GHeroWithFragmentsData_hero_friendsConnection_edges_node @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1355,7 +1374,11 @@ class _$GheroDataData extends GheroDataData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1469,9 +1492,13 @@ class _$GcomparisonFieldsData extends GcomparisonFieldsData { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - friendsConnection.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, friendsConnection.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1610,8 +1637,12 @@ class _$GcomparisonFieldsData_friendsConnection @override int get hashCode { - return $jf($jc($jc($jc(0, G__typename.hashCode), totalCount.hashCode), - edges.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, totalCount.hashCode); + _$hash = $jc(_$hash, edges.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1745,7 +1776,11 @@ class _$GcomparisonFieldsData_friendsConnection_edges @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), node.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, node.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1879,7 +1914,11 @@ class _$GcomparisonFieldsData_friendsConnection_edges_node @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1950,4 +1989,4 @@ class GcomparisonFieldsData_friendsConnection_edges_nodeBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.req.gql.g.dart b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.req.gql.g.dart index 2c956ffb..075810ea 100644 --- a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.req.gql.g.dart @@ -96,7 +96,11 @@ class _$GHeroWithFragments extends GHeroWithFragments { @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -173,4 +177,4 @@ class GHeroWithFragmentsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.var.gql.g.dart b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.var.gql.g.dart index f1550823..dd38fb44 100644 --- a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.var.gql.g.dart @@ -156,7 +156,10 @@ class _$GHeroWithFragmentsVars extends GHeroWithFragmentsVars { @override int get hashCode { - return $jf($jc(0, first.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, first.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -291,7 +294,10 @@ class _$GcomparisonFieldsVars extends GcomparisonFieldsVars { @override int get hashCode { - return $jf($jc(0, first.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, first.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -342,4 +348,4 @@ class GcomparisonFieldsVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.data.gql.g.dart b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.data.gql.g.dart index c19d7668..20c08793 100644 --- a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.data.gql.g.dart @@ -919,7 +919,11 @@ class _$GHeroWithInterfaceSubTypedFragmentsData @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), hero.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, hero.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1052,8 +1056,12 @@ class _$GHeroWithInterfaceSubTypedFragmentsData_hero @override int get hashCode { - return $jf( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1173,8 +1181,12 @@ class _$GheroFieldsFragmentData__base extends GheroFieldsFragmentData__base { @override int get hashCode { - return $jf( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1302,10 +1314,14 @@ class _$GheroFieldsFragmentData__asHuman @override int get hashCode { - return $jf($jc( - $jc($jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - homePlanet.hashCode), - friends.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, homePlanet.hashCode); + _$hash = $jc(_$hash, friends.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1449,7 +1465,10 @@ class _$GheroFieldsFragmentData__asHuman_friends__base @override int get hashCode { - return $jf($jc(0, G__typename.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1569,9 +1588,13 @@ class _$GheroFieldsFragmentData__asHuman_friends__asDroid @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - primaryFunction.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, primaryFunction.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1715,9 +1738,13 @@ class _$GheroFieldsFragmentData__asHuman_friends__asHuman @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - homePlanet.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, homePlanet.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1853,9 +1880,13 @@ class _$GheroFieldsFragmentData__asDroid @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - primaryFunction.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, primaryFunction.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1976,8 +2007,12 @@ class _$GhumanFieldsFragmentData extends GhumanFieldsFragmentData { @override int get hashCode { - return $jf($jc($jc($jc(0, G__typename.hashCode), homePlanet.hashCode), - friends.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, homePlanet.hashCode); + _$hash = $jc(_$hash, friends.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -2099,7 +2134,10 @@ class _$GhumanFieldsFragmentData_friends__base @override int get hashCode { - return $jf($jc(0, G__typename.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -2212,9 +2250,13 @@ class _$GhumanFieldsFragmentData_friends__asDroid @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - primaryFunction.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, primaryFunction.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -2352,9 +2394,13 @@ class _$GhumanFieldsFragmentData_friends__asHuman @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - homePlanet.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, homePlanet.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -2474,7 +2520,11 @@ class _$GdroidFieldsFragmentData extends GdroidFieldsFragmentData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), primaryFunction.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, primaryFunction.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -2539,4 +2589,4 @@ class GdroidFieldsFragmentDataBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.req.gql.g.dart b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.req.gql.g.dart index b33b976f..39a20488 100644 --- a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.req.gql.g.dart @@ -107,7 +107,11 @@ class _$GHeroWithInterfaceSubTypedFragments @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -190,4 +194,4 @@ class GHeroWithInterfaceSubTypedFragmentsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.var.gql.g.dart b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.var.gql.g.dart index 039e22cd..ce583215 100644 --- a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.var.gql.g.dart @@ -173,7 +173,10 @@ class _$GHeroWithInterfaceSubTypedFragmentsVars @override int get hashCode { - return $jf($jc(0, episode.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, episode.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -414,4 +417,4 @@ class GdroidFieldsFragmentVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/graphql/__generated__/schema.ast.gql.dart b/codegen/end_to_end_test/lib/graphql/__generated__/schema.ast.gql.dart index 118f4e7a..168241a6 100644 --- a/codegen/end_to_end_test/lib/graphql/__generated__/schema.ast.gql.dart +++ b/codegen/end_to_end_test/lib/graphql/__generated__/schema.ast.gql.dart @@ -183,6 +183,28 @@ const Query = _i1.ObjectTypeDefinitionNode( isNonNull: false, ), ), + _i1.FieldDefinitionNode( + name: _i1.NameNode(value: 'posts'), + directives: [], + args: [ + _i1.InputValueDefinitionNode( + name: _i1.NameNode(value: 'userId'), + directives: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'ID'), + isNonNull: true, + ), + defaultValue: null, + ) + ], + type: _i1.ListTypeNode( + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'Post'), + isNonNull: false, + ), + isNonNull: false, + ), + ), ], ); const Mutation = _i1.ObjectTypeDefinitionNode( @@ -907,6 +929,131 @@ const Starship = _i1.ObjectTypeDefinitionNode( ), ], ); +const Post = _i1.ObjectTypeDefinitionNode( + name: _i1.NameNode(value: 'Post'), + directives: [], + interfaces: [], + fields: [ + _i1.FieldDefinitionNode( + name: _i1.NameNode(value: 'id'), + directives: [], + args: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'ID'), + isNonNull: true, + ), + ), + _i1.FieldDefinitionNode( + name: _i1.NameNode(value: 'body'), + directives: [], + args: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'String'), + isNonNull: true, + ), + ), + _i1.FieldDefinitionNode( + name: _i1.NameNode(value: 'favoritedUsers'), + directives: [], + args: [ + _i1.InputValueDefinitionNode( + name: _i1.NameNode(value: 'where'), + directives: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'PostLikesInput'), + isNonNull: false, + ), + defaultValue: null, + ) + ], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'PostLikes'), + isNonNull: false, + ), + ), + _i1.FieldDefinitionNode( + name: _i1.NameNode(value: 'likedUsers'), + directives: [], + args: [ + _i1.InputValueDefinitionNode( + name: _i1.NameNode(value: 'where'), + directives: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'PostFavoritesInput'), + isNonNull: false, + ), + defaultValue: null, + ) + ], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'PostFavorites'), + isNonNull: false, + ), + ), + ], +); +const PostLikes = _i1.ObjectTypeDefinitionNode( + name: _i1.NameNode(value: 'PostLikes'), + directives: [], + interfaces: [], + fields: [ + _i1.FieldDefinitionNode( + name: _i1.NameNode(value: 'totalCount'), + directives: [], + args: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'Int'), + isNonNull: true, + ), + ) + ], +); +const PostFavorites = _i1.ObjectTypeDefinitionNode( + name: _i1.NameNode(value: 'PostFavorites'), + directives: [], + interfaces: [], + fields: [ + _i1.FieldDefinitionNode( + name: _i1.NameNode(value: 'totalCount'), + directives: [], + args: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'Int'), + isNonNull: true, + ), + ) + ], +); +const PostLikesInput = _i1.InputObjectTypeDefinitionNode( + name: _i1.NameNode(value: 'PostLikesInput'), + directives: [], + fields: [ + _i1.InputValueDefinitionNode( + name: _i1.NameNode(value: 'id'), + directives: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'ID'), + isNonNull: true, + ), + defaultValue: null, + ) + ], +); +const PostFavoritesInput = _i1.InputObjectTypeDefinitionNode( + name: _i1.NameNode(value: 'PostFavoritesInput'), + directives: [], + fields: [ + _i1.InputValueDefinitionNode( + name: _i1.NameNode(value: 'id'), + directives: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'ID'), + isNonNull: true, + ), + defaultValue: null, + ) + ], +); const SearchResult = _i1.UnionTypeDefinitionNode( name: _i1.NameNode(value: 'SearchResult'), directives: [], @@ -955,6 +1102,11 @@ const document = _i1.DocumentNode(definitions: [ ReviewInput, ColorInput, Starship, + Post, + PostLikes, + PostFavorites, + PostLikesInput, + PostFavoritesInput, SearchResult, Date, ISODate, diff --git a/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.dart b/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.dart index a84cdbf5..ef277200 100644 --- a/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.dart +++ b/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.dart @@ -85,6 +85,48 @@ abstract class GColorInput implements Built { ); } +abstract class GPostLikesInput + implements Built { + GPostLikesInput._(); + + factory GPostLikesInput([Function(GPostLikesInputBuilder b) updates]) = + _$GPostLikesInput; + + String get id; + static Serializer get serializer => + _$gPostLikesInputSerializer; + Map toJson() => (_i1.serializers.serializeWith( + GPostLikesInput.serializer, + this, + ) as Map); + static GPostLikesInput? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostLikesInput.serializer, + json, + ); +} + +abstract class GPostFavoritesInput + implements Built { + GPostFavoritesInput._(); + + factory GPostFavoritesInput( + [Function(GPostFavoritesInputBuilder b) updates]) = _$GPostFavoritesInput; + + String get id; + static Serializer get serializer => + _$gPostFavoritesInputSerializer; + Map toJson() => (_i1.serializers.serializeWith( + GPostFavoritesInput.serializer, + this, + ) as Map); + static GPostFavoritesInput? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostFavoritesInput.serializer, + json, + ); +} + abstract class GISODate implements Built { GISODate._(); diff --git a/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.g.dart b/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.g.dart index 9a393483..5187031b 100644 --- a/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.g.dart +++ b/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.g.dart @@ -55,6 +55,10 @@ Serializer _$gLengthUnitSerializer = new _$GLengthUnitSerializer(); Serializer _$gReviewInputSerializer = new _$GReviewInputSerializer(); Serializer _$gColorInputSerializer = new _$GColorInputSerializer(); +Serializer _$gPostLikesInputSerializer = + new _$GPostLikesInputSerializer(); +Serializer _$gPostFavoritesInputSerializer = + new _$GPostFavoritesInputSerializer(); class _$GEpisodeSerializer implements PrimitiveSerializer { @override @@ -225,6 +229,92 @@ class _$GColorInputSerializer implements StructuredSerializer { } } +class _$GPostLikesInputSerializer + implements StructuredSerializer { + @override + final Iterable types = const [GPostLikesInput, _$GPostLikesInput]; + @override + final String wireName = 'GPostLikesInput'; + + @override + Iterable serialize(Serializers serializers, GPostLikesInput object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + 'id', + serializers.serialize(object.id, specifiedType: const FullType(String)), + ]; + + return result; + } + + @override + GPostLikesInput deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostLikesInputBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case 'id': + result.id = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + } + } + + return result.build(); + } +} + +class _$GPostFavoritesInputSerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + GPostFavoritesInput, + _$GPostFavoritesInput + ]; + @override + final String wireName = 'GPostFavoritesInput'; + + @override + Iterable serialize( + Serializers serializers, GPostFavoritesInput object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + 'id', + serializers.serialize(object.id, specifiedType: const FullType(String)), + ]; + + return result; + } + + @override + GPostFavoritesInput deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostFavoritesInputBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case 'id': + result.id = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + } + } + + return result.build(); + } +} + class _$GReviewInput extends GReviewInput { @override final int stars; @@ -263,10 +353,13 @@ class _$GReviewInput extends GReviewInput { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, stars.hashCode), commentary.hashCode), - favorite_color.hashCode), - seenOn.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, stars.hashCode); + _$hash = $jc(_$hash, commentary.hashCode); + _$hash = $jc(_$hash, favorite_color.hashCode); + _$hash = $jc(_$hash, seenOn.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -395,7 +488,12 @@ class _$GColorInput extends GColorInput { @override int get hashCode { - return $jf($jc($jc($jc(0, red.hashCode), green.hashCode), blue.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, red.hashCode); + _$hash = $jc(_$hash, green.hashCode); + _$hash = $jc(_$hash, blue.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -464,6 +562,174 @@ class GColorInputBuilder implements Builder { } } +class _$GPostLikesInput extends GPostLikesInput { + @override + final String id; + + factory _$GPostLikesInput([void Function(GPostLikesInputBuilder)? updates]) => + (new GPostLikesInputBuilder()..update(updates))._build(); + + _$GPostLikesInput._({required this.id}) : super._() { + BuiltValueNullFieldError.checkNotNull(id, r'GPostLikesInput', 'id'); + } + + @override + GPostLikesInput rebuild(void Function(GPostLikesInputBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostLikesInputBuilder toBuilder() => + new GPostLikesInputBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostLikesInput && id == other.id; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostLikesInput')..add('id', id)) + .toString(); + } +} + +class GPostLikesInputBuilder + implements Builder { + _$GPostLikesInput? _$v; + + String? _id; + String? get id => _$this._id; + set id(String? id) => _$this._id = id; + + GPostLikesInputBuilder(); + + GPostLikesInputBuilder get _$this { + final $v = _$v; + if ($v != null) { + _id = $v.id; + _$v = null; + } + return this; + } + + @override + void replace(GPostLikesInput other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostLikesInput; + } + + @override + void update(void Function(GPostLikesInputBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostLikesInput build() => _build(); + + _$GPostLikesInput _build() { + final _$result = _$v ?? + new _$GPostLikesInput._( + id: BuiltValueNullFieldError.checkNotNull( + id, r'GPostLikesInput', 'id')); + replace(_$result); + return _$result; + } +} + +class _$GPostFavoritesInput extends GPostFavoritesInput { + @override + final String id; + + factory _$GPostFavoritesInput( + [void Function(GPostFavoritesInputBuilder)? updates]) => + (new GPostFavoritesInputBuilder()..update(updates))._build(); + + _$GPostFavoritesInput._({required this.id}) : super._() { + BuiltValueNullFieldError.checkNotNull(id, r'GPostFavoritesInput', 'id'); + } + + @override + GPostFavoritesInput rebuild( + void Function(GPostFavoritesInputBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostFavoritesInputBuilder toBuilder() => + new GPostFavoritesInputBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostFavoritesInput && id == other.id; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostFavoritesInput')..add('id', id)) + .toString(); + } +} + +class GPostFavoritesInputBuilder + implements Builder { + _$GPostFavoritesInput? _$v; + + String? _id; + String? get id => _$this._id; + set id(String? id) => _$this._id = id; + + GPostFavoritesInputBuilder(); + + GPostFavoritesInputBuilder get _$this { + final $v = _$v; + if ($v != null) { + _id = $v.id; + _$v = null; + } + return this; + } + + @override + void replace(GPostFavoritesInput other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostFavoritesInput; + } + + @override + void update(void Function(GPostFavoritesInputBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostFavoritesInput build() => _build(); + + _$GPostFavoritesInput _build() { + final _$result = _$v ?? + new _$GPostFavoritesInput._( + id: BuiltValueNullFieldError.checkNotNull( + id, r'GPostFavoritesInput', 'id')); + replace(_$result); + return _$result; + } +} + class _$GISODate extends GISODate { @override final String value; @@ -490,7 +756,10 @@ class _$GISODate extends GISODate { @override int get hashCode { - return $jf($jc(0, value.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, value.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -542,4 +811,4 @@ class GISODateBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.dart b/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.dart index 28626ae9..4dc390c8 100644 --- a/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.dart +++ b/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.dart @@ -1,6 +1,19 @@ import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; import 'package:built_value/standard_json_plugin.dart' show StandardJsonPlugin; +import 'package:end_to_end_test/aliases/__generated__/alias_var_fragment.data.gql.dart' + show + GPostFragmentData, + GPostFragmentData_isFavorited, + GPostFragmentData_isLiked, + GPostsData, + GPostsData_posts, + GPostsData_posts_isFavorited, + GPostsData_posts_isLiked; +import 'package:end_to_end_test/aliases/__generated__/alias_var_fragment.req.gql.dart' + show GPosts; +import 'package:end_to_end_test/aliases/__generated__/alias_var_fragment.var.gql.dart' + show GPostFragmentVars, GPostsVars; import 'package:end_to_end_test/aliases/__generated__/aliased_hero.data.gql.dart' show GAliasedHeroData, @@ -57,7 +70,14 @@ import 'package:end_to_end_test/fragments/__generated__/hero_with_interface_subt GheroFieldsFragmentVars, GhumanFieldsFragmentVars; import 'package:end_to_end_test/graphql/__generated__/schema.schema.gql.dart' - show GColorInput, GEpisode, GISODate, GLengthUnit, GReviewInput; + show + GColorInput, + GEpisode, + GISODate, + GLengthUnit, + GPostFavoritesInput, + GPostLikesInput, + GReviewInput; import 'package:end_to_end_test/interfaces/__generated__/hero_for_episode.data.gql.dart' show GHeroForEpisodeData_hero, @@ -151,6 +171,18 @@ final SerializersBuilder _serializersBuilder = _$serializers.toBuilder() GHumanWithArgsVars, GISODate, GLengthUnit, + GPostFavoritesInput, + GPostFragmentData, + GPostFragmentData_isFavorited, + GPostFragmentData_isLiked, + GPostFragmentVars, + GPostLikesInput, + GPosts, + GPostsData, + GPostsData_posts, + GPostsData_posts_isFavorited, + GPostsData_posts_isLiked, + GPostsVars, GReviewInput, GReviewWithDate, GReviewWithDateData, diff --git a/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.g.dart b/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.g.dart index 4a6a2114..894a3418 100644 --- a/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.g.dart +++ b/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.g.dart @@ -48,6 +48,18 @@ Serializers _$serializers = (new Serializers().toBuilder() ..add(GHumanWithArgsVars.serializer) ..add(GISODate.serializer) ..add(GLengthUnit.serializer) + ..add(GPostFavoritesInput.serializer) + ..add(GPostFragmentData.serializer) + ..add(GPostFragmentData_isFavorited.serializer) + ..add(GPostFragmentData_isLiked.serializer) + ..add(GPostFragmentVars.serializer) + ..add(GPostLikesInput.serializer) + ..add(GPosts.serializer) + ..add(GPostsData.serializer) + ..add(GPostsData_posts.serializer) + ..add(GPostsData_posts_isFavorited.serializer) + ..add(GPostsData_posts_isLiked.serializer) + ..add(GPostsVars.serializer) ..add(GReviewInput.serializer) ..add(GReviewWithDate.serializer) ..add(GReviewWithDateData.serializer) @@ -106,6 +118,10 @@ Serializers _$serializers = (new Serializers().toBuilder() ]), () => new ListBuilder< GHeroWithFragmentsData_hero_friendsConnection_edges?>()) + ..addBuilderFactory( + const FullType( + BuiltList, const [const FullType.nullable(GPostsData_posts)]), + () => new ListBuilder()) ..addBuilderFactory( const FullType(BuiltList, const [ const FullType.nullable( @@ -125,4 +141,4 @@ Serializers _$serializers = (new Serializers().toBuilder() () => new ListBuilder())) .build(); -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/graphql/schema.graphql b/codegen/end_to_end_test/lib/graphql/schema.graphql index c95faa8f..708e82f7 100644 --- a/codegen/end_to_end_test/lib/graphql/schema.graphql +++ b/codegen/end_to_end_test/lib/graphql/schema.graphql @@ -18,6 +18,7 @@ type Query { droid(id: ID!): Droid human(id: ID!): Human starship(id: ID!): Starship + posts(userId: ID!): [Post] } # The mutation type, represents all updates we can make to our data @@ -174,6 +175,29 @@ type Starship { coordinates: [[Float!]!] } +type Post { + id: ID! + body: String! + favoritedUsers(where: PostLikesInput): PostLikes + likedUsers(where: PostFavoritesInput): PostFavorites +} + +type PostLikes { + totalCount: Int! +} + +type PostFavorites { + totalCount: Int! +} + +input PostLikesInput { + id: ID! +} + +input PostFavoritesInput { + id: ID! +} + union SearchResult = Human | Droid | Starship scalar Date diff --git a/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.data.gql.g.dart b/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.data.gql.g.dart index 3fa28c16..ee58bc38 100644 --- a/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.data.gql.g.dart @@ -419,7 +419,11 @@ class _$GHeroForEpisodeData extends GHeroForEpisodeData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), hero.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, hero.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -523,8 +527,12 @@ class _$GHeroForEpisodeData_hero__base extends GHeroForEpisodeData_hero__base { @override int get hashCode { - return $jf($jc( - $jc($jc(0, G__typename.hashCode), name.hashCode), friends.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, friends.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -655,7 +663,11 @@ class _$GHeroForEpisodeData_hero__base_friends @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -772,9 +784,13 @@ class _$GHeroForEpisodeData_hero__asDroid @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), name.hashCode), friends.hashCode), - primaryFunction.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, friends.hashCode); + _$hash = $jc(_$hash, primaryFunction.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -915,7 +931,11 @@ class _$GHeroForEpisodeData_hero__asDroid_friends @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1019,7 +1039,11 @@ class _$GDroidFragmentData extends GDroidFragmentData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), primaryFunction.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, primaryFunction.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1083,4 +1107,4 @@ class GDroidFragmentDataBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.req.gql.g.dart b/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.req.gql.g.dart index 62c43d0e..fbeddc86 100644 --- a/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.req.gql.g.dart @@ -93,7 +93,11 @@ class _$GHeroForEpisode extends GHeroForEpisode { @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -170,4 +174,4 @@ class GHeroForEpisodeBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.var.gql.g.dart b/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.var.gql.g.dart index 89ab68f7..4de27c1d 100644 --- a/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.var.gql.g.dart @@ -108,7 +108,10 @@ class _$GHeroForEpisodeVars extends GHeroForEpisodeVars { @override int get hashCode { - return $jf($jc(0, ep.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, ep.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -221,4 +224,4 @@ class GDroidFragmentVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.data.gql.g.dart b/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.data.gql.g.dart index a98b4caf..849ff651 100644 --- a/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.data.gql.g.dart @@ -155,7 +155,11 @@ class _$GHeroNoVarsData extends GHeroNoVarsData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), hero.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, hero.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -274,8 +278,12 @@ class _$GHeroNoVarsData_hero extends GHeroNoVarsData_hero { @override int get hashCode { - return $jf( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -347,4 +355,4 @@ class GHeroNoVarsData_heroBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.req.gql.g.dart b/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.req.gql.g.dart index ac4dc32c..d42882c5 100644 --- a/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.req.gql.g.dart @@ -88,7 +88,11 @@ class _$GHeroNoVars extends GHeroNoVars { @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -164,4 +168,4 @@ class GHeroNoVarsBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.var.gql.g.dart b/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.var.gql.g.dart index 4b0f9bbc..c98b3a7e 100644 --- a/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.var.gql.g.dart @@ -88,4 +88,4 @@ class GHeroNoVarsVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.data.gql.g.dart b/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.data.gql.g.dart index 1d688b3b..dd131b05 100644 --- a/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.data.gql.g.dart @@ -211,7 +211,11 @@ class _$GReviewWithDateData extends GReviewWithDateData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), createReview.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, createReview.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -353,16 +357,16 @@ class _$GReviewWithDateData_createReview @override int get hashCode { - return $jf($jc( - $jc( - $jc( - $jc( - $jc($jc($jc(0, G__typename.hashCode), episode.hashCode), - stars.hashCode), - commentary.hashCode), - createdAt.hashCode), - seenOn.hashCode), - custom.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, episode.hashCode); + _$hash = $jc(_$hash, stars.hashCode); + _$hash = $jc(_$hash, commentary.hashCode); + _$hash = $jc(_$hash, createdAt.hashCode); + _$hash = $jc(_$hash, seenOn.hashCode); + _$hash = $jc(_$hash, custom.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -480,4 +484,4 @@ class GReviewWithDateData_createReviewBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.req.gql.g.dart b/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.req.gql.g.dart index 8243b548..91d79828 100644 --- a/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.req.gql.g.dart @@ -93,7 +93,11 @@ class _$GReviewWithDate extends GReviewWithDate { @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -170,4 +174,4 @@ class GReviewWithDateBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.var.gql.g.dart b/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.var.gql.g.dart index b02235e2..7663a833 100644 --- a/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.var.gql.g.dart @@ -116,8 +116,12 @@ class _$GReviewWithDateVars extends GReviewWithDateVars { @override int get hashCode { - return $jf($jc( - $jc($jc(0, episode.hashCode), review.hashCode), createdAt.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, episode.hashCode); + _$hash = $jc(_$hash, review.hashCode); + _$hash = $jc(_$hash, createdAt.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -196,4 +200,4 @@ class GReviewWithDateVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/variables/__generated__/create_review.data.gql.g.dart b/codegen/end_to_end_test/lib/variables/__generated__/create_review.data.gql.g.dart index bfa657d0..9a91b574 100644 --- a/codegen/end_to_end_test/lib/variables/__generated__/create_review.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/variables/__generated__/create_review.data.gql.g.dart @@ -175,7 +175,11 @@ class _$GCreateReviewData extends GCreateReviewData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), createReview.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, createReview.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -300,10 +304,13 @@ class _$GCreateReviewData_createReview extends GCreateReviewData_createReview { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), episode.hashCode), - stars.hashCode), - commentary.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, episode.hashCode); + _$hash = $jc(_$hash, stars.hashCode); + _$hash = $jc(_$hash, commentary.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -383,4 +390,4 @@ class GCreateReviewData_createReviewBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/variables/__generated__/create_review.req.gql.g.dart b/codegen/end_to_end_test/lib/variables/__generated__/create_review.req.gql.g.dart index f3137423..a8262c04 100644 --- a/codegen/end_to_end_test/lib/variables/__generated__/create_review.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/variables/__generated__/create_review.req.gql.g.dart @@ -90,7 +90,11 @@ class _$GCreateReview extends GCreateReview { @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -167,4 +171,4 @@ class GCreateReviewBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/variables/__generated__/create_review.var.gql.g.dart b/codegen/end_to_end_test/lib/variables/__generated__/create_review.var.gql.g.dart index c697e3d7..1077ab97 100644 --- a/codegen/end_to_end_test/lib/variables/__generated__/create_review.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/variables/__generated__/create_review.var.gql.g.dart @@ -96,7 +96,11 @@ class _$GCreateReviewVars extends GCreateReviewVars { @override int get hashCode { - return $jf($jc($jc(0, episode.hashCode), review.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, episode.hashCode); + _$hash = $jc(_$hash, review.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -168,4 +172,4 @@ class GCreateReviewVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.data.gql.g.dart b/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.data.gql.g.dart index 45f31eee..4557ba55 100644 --- a/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.data.gql.g.dart @@ -163,7 +163,11 @@ class _$GHumanWithArgsData extends GHumanWithArgsData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), human.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, human.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -281,8 +285,12 @@ class _$GHumanWithArgsData_human extends GHumanWithArgsData_human { @override int get hashCode { - return $jf( - $jc($jc($jc(0, G__typename.hashCode), name.hashCode), height.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, height.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -354,4 +362,4 @@ class GHumanWithArgsData_humanBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.req.gql.g.dart b/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.req.gql.g.dart index 438ef3b0..4b085286 100644 --- a/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.req.gql.g.dart @@ -93,7 +93,11 @@ class _$GHumanWithArgs extends GHumanWithArgs { @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -170,4 +174,4 @@ class GHumanWithArgsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.var.gql.g.dart b/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.var.gql.g.dart index e36ddcb1..af283a73 100644 --- a/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.var.gql.g.dart @@ -80,7 +80,10 @@ class _$GHumanWithArgsVars extends GHumanWithArgsVars { @override int get hashCode { - return $jf($jc(0, id.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -133,4 +136,4 @@ class GHumanWithArgsVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/gql_code_builder/lib/src/frag_vars.dart b/codegen/gql_code_builder/lib/src/frag_vars.dart index 768b5da2..f1bd1213 100644 --- a/codegen/gql_code_builder/lib/src/frag_vars.dart +++ b/codegen/gql_code_builder/lib/src/frag_vars.dart @@ -1,3 +1,4 @@ +import 'package:collection/collection.dart'; import "package:gql/ast.dart"; import "./common.dart"; @@ -7,13 +8,17 @@ Map fragmentVarTypes({ required FragmentDefinitionNode fragment, required Map fragmentMap, required DocumentNode schema, -}) => - _varTypesForSelections( - fragmentMap: fragmentMap, - selections: fragment.selectionSet.selections, - parentType: fragment.typeCondition.on, - schema: schema, - ); +}) { + print("fragmentVarTypes: ${fragment.name.value}"); + final result = _varTypesForSelections( + fragmentMap: fragmentMap, + selections: fragment.selectionSet.selections, + parentType: fragment.typeCondition.on, + schema: schema, + ); + print("fragmentVarTypes: ${fragment.name.value} ${result.keys.map((e) => e.value).toList()}"); + return result; +} Map _varTypesForSelections({ required List selections, @@ -57,8 +62,7 @@ Map _varTypesForSelections({ } else if (selection is FragmentSpreadNode) { final fragment = fragmentMap[selection.name.value]; if (fragment == null) { - throw Exception( - "Missing fragment definition for ${selection.name.value}"); + throw Exception("Missing fragment definition for ${selection.name.value}"); } return { ...argMap, @@ -90,12 +94,46 @@ Map _varTypesForField({ return { for (final arg in field.arguments) if (arg.value is VariableNode) - arg.name: fieldDef.args - .firstWhere((inputVal) => inputVal.name == arg.name) - .type + arg.name: fieldDef.args.firstWhere((inputVal) => inputVal.name == arg.name).type + else if (arg.value is ObjectValueNode) + ..._varTypesForObjectValue( + argName: arg.name, + objectValue: arg.value as ObjectValueNode, + schema: schema, + parentType: unwrapTypeNode( + fieldDef.args.firstWhere((inputVal) => inputVal.name == arg.name).type), + ) }; } +Map _varTypesForObjectValue({ + required NameNode argName, + required ObjectValueNode objectValue, + required DocumentNode schema, + required NamedTypeNode parentType, +}) { + final parentTypeDef = getTypeDefinitionNode(schema, parentType.name.value); + + if (parentTypeDef is InputObjectTypeDefinitionNode) { + return { + for (final field in objectValue.fields) + if (field.value is VariableNode) + (field.value as VariableNode).name: + parentTypeDef.fields.firstWhere((inputVal) => inputVal.name == field.name).type + else if (field.value is ObjectValueNode) + ..._varTypesForObjectValue( + argName: field.name, + objectValue: field.value as ObjectValueNode, + schema: schema, + parentType: unwrapTypeNode( + parentTypeDef.fields.firstWhere((inputVal) => inputVal.name == field.name).type), + ) + }; + } + throw Exception( + "Parent type definition '${parentTypeDef.runtimeType}' is not an ObjectTypeDefinitionNode"); +} + /// Given a field from a query, fetches the field's definition from the schema FieldDefinitionNode _fieldDefinition({ required FieldNode field, From d7dca2320a1c0f1854814b3a5b109298422d90bb Mon Sep 17 00:00:00 2001 From: Martin Kamleithner Date: Sat, 11 Feb 2023 00:48:27 +0100 Subject: [PATCH 2/8] format --- .../gql_code_builder/lib/src/frag_vars.dart | 25 ++++++++++++------- .../src/operation/definitions/selections.dart | 1 - links/gql_link/lib/src/link.dart | 1 - 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/codegen/gql_code_builder/lib/src/frag_vars.dart b/codegen/gql_code_builder/lib/src/frag_vars.dart index f1bd1213..8ebdead3 100644 --- a/codegen/gql_code_builder/lib/src/frag_vars.dart +++ b/codegen/gql_code_builder/lib/src/frag_vars.dart @@ -16,7 +16,8 @@ Map fragmentVarTypes({ parentType: fragment.typeCondition.on, schema: schema, ); - print("fragmentVarTypes: ${fragment.name.value} ${result.keys.map((e) => e.value).toList()}"); + print( + "fragmentVarTypes: ${fragment.name.value} ${result.keys.map((e) => e.value).toList()}"); return result; } @@ -62,7 +63,8 @@ Map _varTypesForSelections({ } else if (selection is FragmentSpreadNode) { final fragment = fragmentMap[selection.name.value]; if (fragment == null) { - throw Exception("Missing fragment definition for ${selection.name.value}"); + throw Exception( + "Missing fragment definition for ${selection.name.value}"); } return { ...argMap, @@ -94,14 +96,17 @@ Map _varTypesForField({ return { for (final arg in field.arguments) if (arg.value is VariableNode) - arg.name: fieldDef.args.firstWhere((inputVal) => inputVal.name == arg.name).type + arg.name: fieldDef.args + .firstWhere((inputVal) => inputVal.name == arg.name) + .type else if (arg.value is ObjectValueNode) ..._varTypesForObjectValue( argName: arg.name, objectValue: arg.value as ObjectValueNode, schema: schema, - parentType: unwrapTypeNode( - fieldDef.args.firstWhere((inputVal) => inputVal.name == arg.name).type), + parentType: unwrapTypeNode(fieldDef.args + .firstWhere((inputVal) => inputVal.name == arg.name) + .type), ) }; } @@ -118,15 +123,17 @@ Map _varTypesForObjectValue({ return { for (final field in objectValue.fields) if (field.value is VariableNode) - (field.value as VariableNode).name: - parentTypeDef.fields.firstWhere((inputVal) => inputVal.name == field.name).type + (field.value as VariableNode).name: parentTypeDef.fields + .firstWhere((inputVal) => inputVal.name == field.name) + .type else if (field.value is ObjectValueNode) ..._varTypesForObjectValue( argName: field.name, objectValue: field.value as ObjectValueNode, schema: schema, - parentType: unwrapTypeNode( - parentTypeDef.fields.firstWhere((inputVal) => inputVal.name == field.name).type), + parentType: unwrapTypeNode(parentTypeDef.fields + .firstWhere((inputVal) => inputVal.name == field.name) + .type), ) }; } diff --git a/gql/lib/src/operation/definitions/selections.dart b/gql/lib/src/operation/definitions/selections.dart index eab6af9e..451607aa 100644 --- a/gql/lib/src/operation/definitions/selections.dart +++ b/gql/lib/src/operation/definitions/selections.dart @@ -56,7 +56,6 @@ abstract class Selection extends ExecutableWithResolver { static Selection fromNode( SelectionNode astNode, [ - /// The [schemaType] of the containing element TypeDefinition? schemaType, GetExecutableType? getType, diff --git a/links/gql_link/lib/src/link.dart b/links/gql_link/lib/src/link.dart index 2e1f355c..73af9085 100644 --- a/links/gql_link/lib/src/link.dart +++ b/links/gql_link/lib/src/link.dart @@ -89,7 +89,6 @@ abstract class Link { Stream request( /// An incoming [Request] Request request, [ - /// Function that invokes the [request] function of /// the next [Link] /// From fb5343665bed6542f8f239fd60a931e820c4e0e9 Mon Sep 17 00:00:00 2001 From: Martin Kamleithner Date: Sat, 11 Feb 2023 15:31:25 +0100 Subject: [PATCH 3/8] refactor --- .../lib/aliases/alias_var_fragment.graphql | 4 +- .../gql_code_builder/lib/src/frag_vars.dart | 45 ++++++++----------- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql b/codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql index 52e41f29..6d4edc61 100644 --- a/codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql +++ b/codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql @@ -1,9 +1,9 @@ fragment PostFragment on Post { id - isFavorited: favoritedUsers(where: {id: $userId}){ + isFavorited: favoritedUsers(where: {id: $userId}) { totalCount } - isLiked: likedUsers(where: {id: $userId}){ + isLiked: likedUsers(where: {id: $userId}) { totalCount } } diff --git a/codegen/gql_code_builder/lib/src/frag_vars.dart b/codegen/gql_code_builder/lib/src/frag_vars.dart index 8ebdead3..8dfa69ae 100644 --- a/codegen/gql_code_builder/lib/src/frag_vars.dart +++ b/codegen/gql_code_builder/lib/src/frag_vars.dart @@ -1,4 +1,3 @@ -import 'package:collection/collection.dart'; import "package:gql/ast.dart"; import "./common.dart"; @@ -8,18 +7,13 @@ Map fragmentVarTypes({ required FragmentDefinitionNode fragment, required Map fragmentMap, required DocumentNode schema, -}) { - print("fragmentVarTypes: ${fragment.name.value}"); - final result = _varTypesForSelections( - fragmentMap: fragmentMap, - selections: fragment.selectionSet.selections, - parentType: fragment.typeCondition.on, - schema: schema, - ); - print( - "fragmentVarTypes: ${fragment.name.value} ${result.keys.map((e) => e.value).toList()}"); - return result; -} +}) => + _varTypesForSelections( + fragmentMap: fragmentMap, + selections: fragment.selectionSet.selections, + parentType: fragment.typeCondition.on, + schema: schema, + ); Map _varTypesForSelections({ required List selections, @@ -63,8 +57,7 @@ Map _varTypesForSelections({ } else if (selection is FragmentSpreadNode) { final fragment = fragmentMap[selection.name.value]; if (fragment == null) { - throw Exception( - "Missing fragment definition for ${selection.name.value}"); + throw Exception("Missing fragment definition for ${selection.name.value}"); } return { ...argMap, @@ -96,21 +89,21 @@ Map _varTypesForField({ return { for (final arg in field.arguments) if (arg.value is VariableNode) - arg.name: fieldDef.args - .firstWhere((inputVal) => inputVal.name == arg.name) - .type + arg.name: fieldDef.args.firstWhere((inputVal) => inputVal.name == arg.name).type else if (arg.value is ObjectValueNode) ..._varTypesForObjectValue( argName: arg.name, objectValue: arg.value as ObjectValueNode, schema: schema, - parentType: unwrapTypeNode(fieldDef.args - .firstWhere((inputVal) => inputVal.name == arg.name) - .type), + parentType: unwrapTypeNode( + fieldDef.args.firstWhere((inputVal) => inputVal.name == arg.name).type), ) }; } +/// Returns a map of a field's argument variables from a nested object to their respective types from the schema +/// e.g. when used like this: { foo(bar: { baz: $baz }) } +/// the returned map would be { baz: } Map _varTypesForObjectValue({ required NameNode argName, required ObjectValueNode objectValue, @@ -123,17 +116,15 @@ Map _varTypesForObjectValue({ return { for (final field in objectValue.fields) if (field.value is VariableNode) - (field.value as VariableNode).name: parentTypeDef.fields - .firstWhere((inputVal) => inputVal.name == field.name) - .type + (field.value as VariableNode).name: + parentTypeDef.fields.firstWhere((inputVal) => inputVal.name == field.name).type else if (field.value is ObjectValueNode) ..._varTypesForObjectValue( argName: field.name, objectValue: field.value as ObjectValueNode, schema: schema, - parentType: unwrapTypeNode(parentTypeDef.fields - .firstWhere((inputVal) => inputVal.name == field.name) - .type), + parentType: unwrapTypeNode( + parentTypeDef.fields.firstWhere((inputVal) => inputVal.name == field.name).type), ) }; } From 1229dc95496bcf21b956b77a2e762ad2d40c7af6 Mon Sep 17 00:00:00 2001 From: Martin Kamleithner Date: Sat, 11 Feb 2023 18:19:37 +0100 Subject: [PATCH 4/8] investigate ci fails (#383) * fix ci fails --- .github/workflows/dart.yml | 18 +++++++++++++++--- .../src/operation/definitions/selections.dart | 1 - links/gql_link/lib/src/link.dart | 1 - .../test/gql_websocket_link_test.dart | 5 ++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 30f98498..94e7aa60 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -25,8 +25,11 @@ jobs: env: PACKAGE: ${{ matrix.package }} steps: + - name: Workaround for "detected dubious ownership in repository at", see https://github.com/actions/checkout/issues/1169 + run: | + git config --system --add safe.directory /__w/gql/gql - name: Clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Activate multipack run: | echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH @@ -78,14 +81,19 @@ jobs: env: PACKAGE: ${{ matrix.package }} steps: + - name: Workaround for "detected dubious ownership in repository at", see https://github.com/actions/checkout/issues/1169 + run: | + git config --system --add safe.directory /__w/gql/ + git config --system --add safe.directory /__w/gql/gql - name: Clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Activate multipack run: | echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH dart pub global activate multipack - name: Check pubspec run: | + git status multipack --only $PACKAGE pubspec clean multipack --only $PACKAGE exec git diff --exit-code pubspec.yaml - name: Override local dependencies @@ -124,8 +132,12 @@ jobs: env: PACKAGE: ${{ matrix.package }} steps: + - name: Workaround for "detected dubious ownership in repository at", see https://github.com/actions/checkout/issues/1169 + run: | + git config --system --add safe.directory /__w/gql/ + git config --system --add safe.directory /__w/gql/gql - name: Clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Activate multipack run: | echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH diff --git a/gql/lib/src/operation/definitions/selections.dart b/gql/lib/src/operation/definitions/selections.dart index eab6af9e..451607aa 100644 --- a/gql/lib/src/operation/definitions/selections.dart +++ b/gql/lib/src/operation/definitions/selections.dart @@ -56,7 +56,6 @@ abstract class Selection extends ExecutableWithResolver { static Selection fromNode( SelectionNode astNode, [ - /// The [schemaType] of the containing element TypeDefinition? schemaType, GetExecutableType? getType, diff --git a/links/gql_link/lib/src/link.dart b/links/gql_link/lib/src/link.dart index 2e1f355c..73af9085 100644 --- a/links/gql_link/lib/src/link.dart +++ b/links/gql_link/lib/src/link.dart @@ -89,7 +89,6 @@ abstract class Link { Stream request( /// An incoming [Request] Request request, [ - /// Function that invokes the [request] function of /// the next [Link] /// diff --git a/links/gql_websocket_link/test/gql_websocket_link_test.dart b/links/gql_websocket_link/test/gql_websocket_link_test.dart index a76c21c8..283ce5cb 100644 --- a/links/gql_websocket_link/test/gql_websocket_link_test.dart +++ b/links/gql_websocket_link/test/gql_websocket_link_test.dart @@ -1095,6 +1095,9 @@ void main() { WebSocketLink link; Request request; + final server = await HttpServer.bind("localhost", 0); + final port = server.port; + request = Request( operation: Operation( operationName: "sub", @@ -1105,7 +1108,7 @@ void main() { link = WebSocketLink( null, channelGenerator: expectAsync0( - () async => IOWebSocketChannel.connect("ws://localhost"), + () async => IOWebSocketChannel.connect("ws://localhost:$port"), count: 1, max: 1, ), From 9675337010cc185037ecb15be89bd3f050285e0d Mon Sep 17 00:00:00 2001 From: Martin Kamleithner Date: Sat, 11 Feb 2023 00:46:33 +0100 Subject: [PATCH 5/8] fix(gql_code_builder): improve variable resolution in fragment types --- .../alias_var_fragment.ast.gql.dart | 113 ++ .../alias_var_fragment.data.gql.dart | 245 ++++ .../alias_var_fragment.data.gql.g.dart | 1272 +++++++++++++++++ .../alias_var_fragment.req.gql.dart | 39 + .../alias_var_fragment.req.gql.g.dart | 170 +++ .../alias_var_fragment.var.gql.dart | 49 + .../alias_var_fragment.var.gql.g.dart | 262 ++++ .../aliased_hero.data.gql.g.dart | 30 +- .../__generated__/aliased_hero.req.gql.g.dart | 8 +- .../__generated__/aliased_hero.var.gql.g.dart | 7 +- .../lib/aliases/alias_var_fragment.graphql | 15 + .../hero_with_fragments.data.gql.g.dart | 75 +- .../hero_with_fragments.req.gql.g.dart | 8 +- .../hero_with_fragments.var.gql.g.dart | 12 +- ...terface_subtyped_fragments.data.gql.g.dart | 110 +- ...nterface_subtyped_fragments.req.gql.g.dart | 8 +- ...nterface_subtyped_fragments.var.gql.g.dart | 7 +- .../graphql/__generated__/schema.ast.gql.dart | 152 ++ .../__generated__/schema.schema.gql.dart | 42 + .../__generated__/schema.schema.gql.g.dart | 283 +++- .../__generated__/serializers.gql.dart | 34 +- .../__generated__/serializers.gql.g.dart | 18 +- .../lib/graphql/schema.graphql | 24 + .../hero_for_episode.data.gql.g.dart | 44 +- .../hero_for_episode.req.gql.g.dart | 8 +- .../hero_for_episode.var.gql.g.dart | 7 +- .../hero_no_vars.data.gql.g.dart | 16 +- .../__generated__/hero_no_vars.req.gql.g.dart | 8 +- .../__generated__/hero_no_vars.var.gql.g.dart | 2 +- .../review_with_date.data.gql.g.dart | 28 +- .../review_with_date.req.gql.g.dart | 8 +- .../review_with_date.var.gql.g.dart | 10 +- .../create_review.data.gql.g.dart | 19 +- .../create_review.req.gql.g.dart | 8 +- .../create_review.var.gql.g.dart | 8 +- .../human_with_args.data.gql.g.dart | 16 +- .../human_with_args.req.gql.g.dart | 8 +- .../human_with_args.var.gql.g.dart | 7 +- .../gql_code_builder/lib/src/frag_vars.dart | 62 +- 39 files changed, 3095 insertions(+), 147 deletions(-) create mode 100644 codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.ast.gql.dart create mode 100644 codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.dart create mode 100644 codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.g.dart create mode 100644 codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.dart create mode 100644 codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.g.dart create mode 100644 codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.dart create mode 100644 codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.g.dart create mode 100644 codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.ast.gql.dart b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.ast.gql.dart new file mode 100644 index 00000000..f559a4f1 --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.ast.gql.dart @@ -0,0 +1,113 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:gql/ast.dart' as _i1; + +const PostFragment = _i1.FragmentDefinitionNode( + name: _i1.NameNode(value: 'PostFragment'), + typeCondition: _i1.TypeConditionNode( + on: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'Post'), + isNonNull: false, + )), + directives: [], + selectionSet: _i1.SelectionSetNode(selections: [ + _i1.FieldNode( + name: _i1.NameNode(value: 'id'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + _i1.FieldNode( + name: _i1.NameNode(value: 'favoritedUsers'), + alias: _i1.NameNode(value: 'isFavorited'), + arguments: [ + _i1.ArgumentNode( + name: _i1.NameNode(value: 'where'), + value: _i1.ObjectValueNode(fields: [ + _i1.ObjectFieldNode( + name: _i1.NameNode(value: 'id'), + value: _i1.VariableNode(name: _i1.NameNode(value: 'userId')), + ) + ]), + ) + ], + directives: [], + selectionSet: _i1.SelectionSetNode(selections: [ + _i1.FieldNode( + name: _i1.NameNode(value: 'totalCount'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ) + ]), + ), + _i1.FieldNode( + name: _i1.NameNode(value: 'likedUsers'), + alias: _i1.NameNode(value: 'isLiked'), + arguments: [ + _i1.ArgumentNode( + name: _i1.NameNode(value: 'where'), + value: _i1.ObjectValueNode(fields: [ + _i1.ObjectFieldNode( + name: _i1.NameNode(value: 'id'), + value: _i1.VariableNode(name: _i1.NameNode(value: 'userId')), + ) + ]), + ) + ], + directives: [], + selectionSet: _i1.SelectionSetNode(selections: [ + _i1.FieldNode( + name: _i1.NameNode(value: 'totalCount'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ) + ]), + ), + ]), +); +const Posts = _i1.OperationDefinitionNode( + type: _i1.OperationType.query, + name: _i1.NameNode(value: 'Posts'), + variableDefinitions: [ + _i1.VariableDefinitionNode( + variable: _i1.VariableNode(name: _i1.NameNode(value: 'userId')), + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'ID'), + isNonNull: true, + ), + defaultValue: _i1.DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: _i1.SelectionSetNode(selections: [ + _i1.FieldNode( + name: _i1.NameNode(value: 'posts'), + alias: null, + arguments: [ + _i1.ArgumentNode( + name: _i1.NameNode(value: 'userId'), + value: _i1.VariableNode(name: _i1.NameNode(value: 'userId')), + ) + ], + directives: [], + selectionSet: _i1.SelectionSetNode(selections: [ + _i1.FragmentSpreadNode( + name: _i1.NameNode(value: 'PostFragment'), + directives: [], + ) + ]), + ) + ]), +); +const document = _i1.DocumentNode(definitions: [ + PostFragment, + Posts, +]); diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.dart b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.dart new file mode 100644 index 00000000..10ad5bcd --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.dart @@ -0,0 +1,245 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:end_to_end_test/graphql/__generated__/serializers.gql.dart' + as _i1; + +part 'alias_var_fragment.data.gql.g.dart'; + +abstract class GPostsData implements Built { + GPostsData._(); + + factory GPostsData([Function(GPostsDataBuilder b) updates]) = _$GPostsData; + + static void _initializeBuilder(GPostsDataBuilder b) => + b..G__typename = 'Query'; + @BuiltValueField(wireName: '__typename') + String get G__typename; + BuiltList? get posts; + static Serializer get serializer => _$gPostsDataSerializer; + Map toJson() => (_i1.serializers.serializeWith( + GPostsData.serializer, + this, + ) as Map); + static GPostsData? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostsData.serializer, + json, + ); +} + +abstract class GPostsData_posts + implements Built, GPostFragment { + GPostsData_posts._(); + + factory GPostsData_posts([Function(GPostsData_postsBuilder b) updates]) = + _$GPostsData_posts; + + static void _initializeBuilder(GPostsData_postsBuilder b) => + b..G__typename = 'Post'; + @override + @BuiltValueField(wireName: '__typename') + String get G__typename; + @override + String get id; + @override + GPostsData_posts_isFavorited? get isFavorited; + @override + GPostsData_posts_isLiked? get isLiked; + static Serializer get serializer => + _$gPostsDataPostsSerializer; + @override + Map toJson() => (_i1.serializers.serializeWith( + GPostsData_posts.serializer, + this, + ) as Map); + static GPostsData_posts? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostsData_posts.serializer, + json, + ); +} + +abstract class GPostsData_posts_isFavorited + implements + Built, + GPostFragment_isFavorited { + GPostsData_posts_isFavorited._(); + + factory GPostsData_posts_isFavorited( + [Function(GPostsData_posts_isFavoritedBuilder b) updates]) = + _$GPostsData_posts_isFavorited; + + static void _initializeBuilder(GPostsData_posts_isFavoritedBuilder b) => + b..G__typename = 'PostLikes'; + @override + @BuiltValueField(wireName: '__typename') + String get G__typename; + @override + int get totalCount; + static Serializer get serializer => + _$gPostsDataPostsIsFavoritedSerializer; + @override + Map toJson() => (_i1.serializers.serializeWith( + GPostsData_posts_isFavorited.serializer, + this, + ) as Map); + static GPostsData_posts_isFavorited? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostsData_posts_isFavorited.serializer, + json, + ); +} + +abstract class GPostsData_posts_isLiked + implements + Built, + GPostFragment_isLiked { + GPostsData_posts_isLiked._(); + + factory GPostsData_posts_isLiked( + [Function(GPostsData_posts_isLikedBuilder b) updates]) = + _$GPostsData_posts_isLiked; + + static void _initializeBuilder(GPostsData_posts_isLikedBuilder b) => + b..G__typename = 'PostFavorites'; + @override + @BuiltValueField(wireName: '__typename') + String get G__typename; + @override + int get totalCount; + static Serializer get serializer => + _$gPostsDataPostsIsLikedSerializer; + @override + Map toJson() => (_i1.serializers.serializeWith( + GPostsData_posts_isLiked.serializer, + this, + ) as Map); + static GPostsData_posts_isLiked? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostsData_posts_isLiked.serializer, + json, + ); +} + +abstract class GPostFragment { + String get G__typename; + String get id; + GPostFragment_isFavorited? get isFavorited; + GPostFragment_isLiked? get isLiked; + Map toJson(); +} + +abstract class GPostFragment_isFavorited { + String get G__typename; + int get totalCount; + Map toJson(); +} + +abstract class GPostFragment_isLiked { + String get G__typename; + int get totalCount; + Map toJson(); +} + +abstract class GPostFragmentData + implements + Built, + GPostFragment { + GPostFragmentData._(); + + factory GPostFragmentData([Function(GPostFragmentDataBuilder b) updates]) = + _$GPostFragmentData; + + static void _initializeBuilder(GPostFragmentDataBuilder b) => + b..G__typename = 'Post'; + @override + @BuiltValueField(wireName: '__typename') + String get G__typename; + @override + String get id; + @override + GPostFragmentData_isFavorited? get isFavorited; + @override + GPostFragmentData_isLiked? get isLiked; + static Serializer get serializer => + _$gPostFragmentDataSerializer; + @override + Map toJson() => (_i1.serializers.serializeWith( + GPostFragmentData.serializer, + this, + ) as Map); + static GPostFragmentData? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostFragmentData.serializer, + json, + ); +} + +abstract class GPostFragmentData_isFavorited + implements + Built, + GPostFragment_isFavorited { + GPostFragmentData_isFavorited._(); + + factory GPostFragmentData_isFavorited( + [Function(GPostFragmentData_isFavoritedBuilder b) updates]) = + _$GPostFragmentData_isFavorited; + + static void _initializeBuilder(GPostFragmentData_isFavoritedBuilder b) => + b..G__typename = 'PostLikes'; + @override + @BuiltValueField(wireName: '__typename') + String get G__typename; + @override + int get totalCount; + static Serializer get serializer => + _$gPostFragmentDataIsFavoritedSerializer; + @override + Map toJson() => (_i1.serializers.serializeWith( + GPostFragmentData_isFavorited.serializer, + this, + ) as Map); + static GPostFragmentData_isFavorited? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostFragmentData_isFavorited.serializer, + json, + ); +} + +abstract class GPostFragmentData_isLiked + implements + Built, + GPostFragment_isLiked { + GPostFragmentData_isLiked._(); + + factory GPostFragmentData_isLiked( + [Function(GPostFragmentData_isLikedBuilder b) updates]) = + _$GPostFragmentData_isLiked; + + static void _initializeBuilder(GPostFragmentData_isLikedBuilder b) => + b..G__typename = 'PostFavorites'; + @override + @BuiltValueField(wireName: '__typename') + String get G__typename; + @override + int get totalCount; + static Serializer get serializer => + _$gPostFragmentDataIsLikedSerializer; + @override + Map toJson() => (_i1.serializers.serializeWith( + GPostFragmentData_isLiked.serializer, + this, + ) as Map); + static GPostFragmentData_isLiked? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostFragmentData_isLiked.serializer, + json, + ); +} diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.g.dart b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.g.dart new file mode 100644 index 00000000..bdd60526 --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.data.gql.g.dart @@ -0,0 +1,1272 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'alias_var_fragment.data.gql.dart'; + +// ************************************************************************** +// BuiltValueGenerator +// ************************************************************************** + +Serializer _$gPostsDataSerializer = new _$GPostsDataSerializer(); +Serializer _$gPostsDataPostsSerializer = + new _$GPostsData_postsSerializer(); +Serializer + _$gPostsDataPostsIsFavoritedSerializer = + new _$GPostsData_posts_isFavoritedSerializer(); +Serializer _$gPostsDataPostsIsLikedSerializer = + new _$GPostsData_posts_isLikedSerializer(); +Serializer _$gPostFragmentDataSerializer = + new _$GPostFragmentDataSerializer(); +Serializer + _$gPostFragmentDataIsFavoritedSerializer = + new _$GPostFragmentData_isFavoritedSerializer(); +Serializer _$gPostFragmentDataIsLikedSerializer = + new _$GPostFragmentData_isLikedSerializer(); + +class _$GPostsDataSerializer implements StructuredSerializer { + @override + final Iterable types = const [GPostsData, _$GPostsData]; + @override + final String wireName = 'GPostsData'; + + @override + Iterable serialize(Serializers serializers, GPostsData object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + '__typename', + serializers.serialize(object.G__typename, + specifiedType: const FullType(String)), + ]; + Object? value; + value = object.posts; + if (value != null) { + result + ..add('posts') + ..add(serializers.serialize(value, + specifiedType: const FullType( + BuiltList, const [const FullType.nullable(GPostsData_posts)]))); + } + return result; + } + + @override + GPostsData deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostsDataBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case '__typename': + result.G__typename = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'posts': + result.posts.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltList, const [ + const FullType.nullable(GPostsData_posts) + ]))! as BuiltList); + break; + } + } + + return result.build(); + } +} + +class _$GPostsData_postsSerializer + implements StructuredSerializer { + @override + final Iterable types = const [GPostsData_posts, _$GPostsData_posts]; + @override + final String wireName = 'GPostsData_posts'; + + @override + Iterable serialize(Serializers serializers, GPostsData_posts object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + '__typename', + serializers.serialize(object.G__typename, + specifiedType: const FullType(String)), + 'id', + serializers.serialize(object.id, specifiedType: const FullType(String)), + ]; + Object? value; + value = object.isFavorited; + if (value != null) { + result + ..add('isFavorited') + ..add(serializers.serialize(value, + specifiedType: const FullType(GPostsData_posts_isFavorited))); + } + value = object.isLiked; + if (value != null) { + result + ..add('isLiked') + ..add(serializers.serialize(value, + specifiedType: const FullType(GPostsData_posts_isLiked))); + } + return result; + } + + @override + GPostsData_posts deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostsData_postsBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case '__typename': + result.G__typename = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'id': + result.id = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'isFavorited': + result.isFavorited.replace(serializers.deserialize(value, + specifiedType: const FullType(GPostsData_posts_isFavorited))! + as GPostsData_posts_isFavorited); + break; + case 'isLiked': + result.isLiked.replace(serializers.deserialize(value, + specifiedType: const FullType(GPostsData_posts_isLiked))! + as GPostsData_posts_isLiked); + break; + } + } + + return result.build(); + } +} + +class _$GPostsData_posts_isFavoritedSerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + GPostsData_posts_isFavorited, + _$GPostsData_posts_isFavorited + ]; + @override + final String wireName = 'GPostsData_posts_isFavorited'; + + @override + Iterable serialize( + Serializers serializers, GPostsData_posts_isFavorited object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + '__typename', + serializers.serialize(object.G__typename, + specifiedType: const FullType(String)), + 'totalCount', + serializers.serialize(object.totalCount, + specifiedType: const FullType(int)), + ]; + + return result; + } + + @override + GPostsData_posts_isFavorited deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostsData_posts_isFavoritedBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case '__typename': + result.G__typename = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'totalCount': + result.totalCount = serializers.deserialize(value, + specifiedType: const FullType(int))! as int; + break; + } + } + + return result.build(); + } +} + +class _$GPostsData_posts_isLikedSerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + GPostsData_posts_isLiked, + _$GPostsData_posts_isLiked + ]; + @override + final String wireName = 'GPostsData_posts_isLiked'; + + @override + Iterable serialize( + Serializers serializers, GPostsData_posts_isLiked object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + '__typename', + serializers.serialize(object.G__typename, + specifiedType: const FullType(String)), + 'totalCount', + serializers.serialize(object.totalCount, + specifiedType: const FullType(int)), + ]; + + return result; + } + + @override + GPostsData_posts_isLiked deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostsData_posts_isLikedBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case '__typename': + result.G__typename = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'totalCount': + result.totalCount = serializers.deserialize(value, + specifiedType: const FullType(int))! as int; + break; + } + } + + return result.build(); + } +} + +class _$GPostFragmentDataSerializer + implements StructuredSerializer { + @override + final Iterable types = const [GPostFragmentData, _$GPostFragmentData]; + @override + final String wireName = 'GPostFragmentData'; + + @override + Iterable serialize(Serializers serializers, GPostFragmentData object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + '__typename', + serializers.serialize(object.G__typename, + specifiedType: const FullType(String)), + 'id', + serializers.serialize(object.id, specifiedType: const FullType(String)), + ]; + Object? value; + value = object.isFavorited; + if (value != null) { + result + ..add('isFavorited') + ..add(serializers.serialize(value, + specifiedType: const FullType(GPostFragmentData_isFavorited))); + } + value = object.isLiked; + if (value != null) { + result + ..add('isLiked') + ..add(serializers.serialize(value, + specifiedType: const FullType(GPostFragmentData_isLiked))); + } + return result; + } + + @override + GPostFragmentData deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostFragmentDataBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case '__typename': + result.G__typename = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'id': + result.id = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'isFavorited': + result.isFavorited.replace(serializers.deserialize(value, + specifiedType: const FullType(GPostFragmentData_isFavorited))! + as GPostFragmentData_isFavorited); + break; + case 'isLiked': + result.isLiked.replace(serializers.deserialize(value, + specifiedType: const FullType(GPostFragmentData_isLiked))! + as GPostFragmentData_isLiked); + break; + } + } + + return result.build(); + } +} + +class _$GPostFragmentData_isFavoritedSerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + GPostFragmentData_isFavorited, + _$GPostFragmentData_isFavorited + ]; + @override + final String wireName = 'GPostFragmentData_isFavorited'; + + @override + Iterable serialize( + Serializers serializers, GPostFragmentData_isFavorited object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + '__typename', + serializers.serialize(object.G__typename, + specifiedType: const FullType(String)), + 'totalCount', + serializers.serialize(object.totalCount, + specifiedType: const FullType(int)), + ]; + + return result; + } + + @override + GPostFragmentData_isFavorited deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostFragmentData_isFavoritedBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case '__typename': + result.G__typename = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'totalCount': + result.totalCount = serializers.deserialize(value, + specifiedType: const FullType(int))! as int; + break; + } + } + + return result.build(); + } +} + +class _$GPostFragmentData_isLikedSerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + GPostFragmentData_isLiked, + _$GPostFragmentData_isLiked + ]; + @override + final String wireName = 'GPostFragmentData_isLiked'; + + @override + Iterable serialize( + Serializers serializers, GPostFragmentData_isLiked object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + '__typename', + serializers.serialize(object.G__typename, + specifiedType: const FullType(String)), + 'totalCount', + serializers.serialize(object.totalCount, + specifiedType: const FullType(int)), + ]; + + return result; + } + + @override + GPostFragmentData_isLiked deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostFragmentData_isLikedBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case '__typename': + result.G__typename = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + case 'totalCount': + result.totalCount = serializers.deserialize(value, + specifiedType: const FullType(int))! as int; + break; + } + } + + return result.build(); + } +} + +class _$GPostsData extends GPostsData { + @override + final String G__typename; + @override + final BuiltList? posts; + + factory _$GPostsData([void Function(GPostsDataBuilder)? updates]) => + (new GPostsDataBuilder()..update(updates))._build(); + + _$GPostsData._({required this.G__typename, this.posts}) : super._() { + BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData', 'G__typename'); + } + + @override + GPostsData rebuild(void Function(GPostsDataBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostsDataBuilder toBuilder() => new GPostsDataBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostsData && + G__typename == other.G__typename && + posts == other.posts; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, posts.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostsData') + ..add('G__typename', G__typename) + ..add('posts', posts)) + .toString(); + } +} + +class GPostsDataBuilder implements Builder { + _$GPostsData? _$v; + + String? _G__typename; + String? get G__typename => _$this._G__typename; + set G__typename(String? G__typename) => _$this._G__typename = G__typename; + + ListBuilder? _posts; + ListBuilder get posts => + _$this._posts ??= new ListBuilder(); + set posts(ListBuilder? posts) => _$this._posts = posts; + + GPostsDataBuilder() { + GPostsData._initializeBuilder(this); + } + + GPostsDataBuilder get _$this { + final $v = _$v; + if ($v != null) { + _G__typename = $v.G__typename; + _posts = $v.posts?.toBuilder(); + _$v = null; + } + return this; + } + + @override + void replace(GPostsData other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostsData; + } + + @override + void update(void Function(GPostsDataBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostsData build() => _build(); + + _$GPostsData _build() { + _$GPostsData _$result; + try { + _$result = _$v ?? + new _$GPostsData._( + G__typename: BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData', 'G__typename'), + posts: _posts?.build()); + } catch (_) { + late String _$failedField; + try { + _$failedField = 'posts'; + _posts?.build(); + } catch (e) { + throw new BuiltValueNestedFieldError( + r'GPostsData', _$failedField, e.toString()); + } + rethrow; + } + replace(_$result); + return _$result; + } +} + +class _$GPostsData_posts extends GPostsData_posts { + @override + final String G__typename; + @override + final String id; + @override + final GPostsData_posts_isFavorited? isFavorited; + @override + final GPostsData_posts_isLiked? isLiked; + + factory _$GPostsData_posts( + [void Function(GPostsData_postsBuilder)? updates]) => + (new GPostsData_postsBuilder()..update(updates))._build(); + + _$GPostsData_posts._( + {required this.G__typename, + required this.id, + this.isFavorited, + this.isLiked}) + : super._() { + BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData_posts', 'G__typename'); + BuiltValueNullFieldError.checkNotNull(id, r'GPostsData_posts', 'id'); + } + + @override + GPostsData_posts rebuild(void Function(GPostsData_postsBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostsData_postsBuilder toBuilder() => + new GPostsData_postsBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostsData_posts && + G__typename == other.G__typename && + id == other.id && + isFavorited == other.isFavorited && + isLiked == other.isLiked; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, isFavorited.hashCode); + _$hash = $jc(_$hash, isLiked.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostsData_posts') + ..add('G__typename', G__typename) + ..add('id', id) + ..add('isFavorited', isFavorited) + ..add('isLiked', isLiked)) + .toString(); + } +} + +class GPostsData_postsBuilder + implements Builder { + _$GPostsData_posts? _$v; + + String? _G__typename; + String? get G__typename => _$this._G__typename; + set G__typename(String? G__typename) => _$this._G__typename = G__typename; + + String? _id; + String? get id => _$this._id; + set id(String? id) => _$this._id = id; + + GPostsData_posts_isFavoritedBuilder? _isFavorited; + GPostsData_posts_isFavoritedBuilder get isFavorited => + _$this._isFavorited ??= new GPostsData_posts_isFavoritedBuilder(); + set isFavorited(GPostsData_posts_isFavoritedBuilder? isFavorited) => + _$this._isFavorited = isFavorited; + + GPostsData_posts_isLikedBuilder? _isLiked; + GPostsData_posts_isLikedBuilder get isLiked => + _$this._isLiked ??= new GPostsData_posts_isLikedBuilder(); + set isLiked(GPostsData_posts_isLikedBuilder? isLiked) => + _$this._isLiked = isLiked; + + GPostsData_postsBuilder() { + GPostsData_posts._initializeBuilder(this); + } + + GPostsData_postsBuilder get _$this { + final $v = _$v; + if ($v != null) { + _G__typename = $v.G__typename; + _id = $v.id; + _isFavorited = $v.isFavorited?.toBuilder(); + _isLiked = $v.isLiked?.toBuilder(); + _$v = null; + } + return this; + } + + @override + void replace(GPostsData_posts other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostsData_posts; + } + + @override + void update(void Function(GPostsData_postsBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostsData_posts build() => _build(); + + _$GPostsData_posts _build() { + _$GPostsData_posts _$result; + try { + _$result = _$v ?? + new _$GPostsData_posts._( + G__typename: BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData_posts', 'G__typename'), + id: BuiltValueNullFieldError.checkNotNull( + id, r'GPostsData_posts', 'id'), + isFavorited: _isFavorited?.build(), + isLiked: _isLiked?.build()); + } catch (_) { + late String _$failedField; + try { + _$failedField = 'isFavorited'; + _isFavorited?.build(); + _$failedField = 'isLiked'; + _isLiked?.build(); + } catch (e) { + throw new BuiltValueNestedFieldError( + r'GPostsData_posts', _$failedField, e.toString()); + } + rethrow; + } + replace(_$result); + return _$result; + } +} + +class _$GPostsData_posts_isFavorited extends GPostsData_posts_isFavorited { + @override + final String G__typename; + @override + final int totalCount; + + factory _$GPostsData_posts_isFavorited( + [void Function(GPostsData_posts_isFavoritedBuilder)? updates]) => + (new GPostsData_posts_isFavoritedBuilder()..update(updates))._build(); + + _$GPostsData_posts_isFavorited._( + {required this.G__typename, required this.totalCount}) + : super._() { + BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData_posts_isFavorited', 'G__typename'); + BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostsData_posts_isFavorited', 'totalCount'); + } + + @override + GPostsData_posts_isFavorited rebuild( + void Function(GPostsData_posts_isFavoritedBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostsData_posts_isFavoritedBuilder toBuilder() => + new GPostsData_posts_isFavoritedBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostsData_posts_isFavorited && + G__typename == other.G__typename && + totalCount == other.totalCount; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, totalCount.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostsData_posts_isFavorited') + ..add('G__typename', G__typename) + ..add('totalCount', totalCount)) + .toString(); + } +} + +class GPostsData_posts_isFavoritedBuilder + implements + Builder { + _$GPostsData_posts_isFavorited? _$v; + + String? _G__typename; + String? get G__typename => _$this._G__typename; + set G__typename(String? G__typename) => _$this._G__typename = G__typename; + + int? _totalCount; + int? get totalCount => _$this._totalCount; + set totalCount(int? totalCount) => _$this._totalCount = totalCount; + + GPostsData_posts_isFavoritedBuilder() { + GPostsData_posts_isFavorited._initializeBuilder(this); + } + + GPostsData_posts_isFavoritedBuilder get _$this { + final $v = _$v; + if ($v != null) { + _G__typename = $v.G__typename; + _totalCount = $v.totalCount; + _$v = null; + } + return this; + } + + @override + void replace(GPostsData_posts_isFavorited other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostsData_posts_isFavorited; + } + + @override + void update(void Function(GPostsData_posts_isFavoritedBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostsData_posts_isFavorited build() => _build(); + + _$GPostsData_posts_isFavorited _build() { + final _$result = _$v ?? + new _$GPostsData_posts_isFavorited._( + G__typename: BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData_posts_isFavorited', 'G__typename'), + totalCount: BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostsData_posts_isFavorited', 'totalCount')); + replace(_$result); + return _$result; + } +} + +class _$GPostsData_posts_isLiked extends GPostsData_posts_isLiked { + @override + final String G__typename; + @override + final int totalCount; + + factory _$GPostsData_posts_isLiked( + [void Function(GPostsData_posts_isLikedBuilder)? updates]) => + (new GPostsData_posts_isLikedBuilder()..update(updates))._build(); + + _$GPostsData_posts_isLiked._( + {required this.G__typename, required this.totalCount}) + : super._() { + BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData_posts_isLiked', 'G__typename'); + BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostsData_posts_isLiked', 'totalCount'); + } + + @override + GPostsData_posts_isLiked rebuild( + void Function(GPostsData_posts_isLikedBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostsData_posts_isLikedBuilder toBuilder() => + new GPostsData_posts_isLikedBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostsData_posts_isLiked && + G__typename == other.G__typename && + totalCount == other.totalCount; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, totalCount.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostsData_posts_isLiked') + ..add('G__typename', G__typename) + ..add('totalCount', totalCount)) + .toString(); + } +} + +class GPostsData_posts_isLikedBuilder + implements + Builder { + _$GPostsData_posts_isLiked? _$v; + + String? _G__typename; + String? get G__typename => _$this._G__typename; + set G__typename(String? G__typename) => _$this._G__typename = G__typename; + + int? _totalCount; + int? get totalCount => _$this._totalCount; + set totalCount(int? totalCount) => _$this._totalCount = totalCount; + + GPostsData_posts_isLikedBuilder() { + GPostsData_posts_isLiked._initializeBuilder(this); + } + + GPostsData_posts_isLikedBuilder get _$this { + final $v = _$v; + if ($v != null) { + _G__typename = $v.G__typename; + _totalCount = $v.totalCount; + _$v = null; + } + return this; + } + + @override + void replace(GPostsData_posts_isLiked other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostsData_posts_isLiked; + } + + @override + void update(void Function(GPostsData_posts_isLikedBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostsData_posts_isLiked build() => _build(); + + _$GPostsData_posts_isLiked _build() { + final _$result = _$v ?? + new _$GPostsData_posts_isLiked._( + G__typename: BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostsData_posts_isLiked', 'G__typename'), + totalCount: BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostsData_posts_isLiked', 'totalCount')); + replace(_$result); + return _$result; + } +} + +class _$GPostFragmentData extends GPostFragmentData { + @override + final String G__typename; + @override + final String id; + @override + final GPostFragmentData_isFavorited? isFavorited; + @override + final GPostFragmentData_isLiked? isLiked; + + factory _$GPostFragmentData( + [void Function(GPostFragmentDataBuilder)? updates]) => + (new GPostFragmentDataBuilder()..update(updates))._build(); + + _$GPostFragmentData._( + {required this.G__typename, + required this.id, + this.isFavorited, + this.isLiked}) + : super._() { + BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostFragmentData', 'G__typename'); + BuiltValueNullFieldError.checkNotNull(id, r'GPostFragmentData', 'id'); + } + + @override + GPostFragmentData rebuild(void Function(GPostFragmentDataBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostFragmentDataBuilder toBuilder() => + new GPostFragmentDataBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostFragmentData && + G__typename == other.G__typename && + id == other.id && + isFavorited == other.isFavorited && + isLiked == other.isLiked; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, isFavorited.hashCode); + _$hash = $jc(_$hash, isLiked.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostFragmentData') + ..add('G__typename', G__typename) + ..add('id', id) + ..add('isFavorited', isFavorited) + ..add('isLiked', isLiked)) + .toString(); + } +} + +class GPostFragmentDataBuilder + implements Builder { + _$GPostFragmentData? _$v; + + String? _G__typename; + String? get G__typename => _$this._G__typename; + set G__typename(String? G__typename) => _$this._G__typename = G__typename; + + String? _id; + String? get id => _$this._id; + set id(String? id) => _$this._id = id; + + GPostFragmentData_isFavoritedBuilder? _isFavorited; + GPostFragmentData_isFavoritedBuilder get isFavorited => + _$this._isFavorited ??= new GPostFragmentData_isFavoritedBuilder(); + set isFavorited(GPostFragmentData_isFavoritedBuilder? isFavorited) => + _$this._isFavorited = isFavorited; + + GPostFragmentData_isLikedBuilder? _isLiked; + GPostFragmentData_isLikedBuilder get isLiked => + _$this._isLiked ??= new GPostFragmentData_isLikedBuilder(); + set isLiked(GPostFragmentData_isLikedBuilder? isLiked) => + _$this._isLiked = isLiked; + + GPostFragmentDataBuilder() { + GPostFragmentData._initializeBuilder(this); + } + + GPostFragmentDataBuilder get _$this { + final $v = _$v; + if ($v != null) { + _G__typename = $v.G__typename; + _id = $v.id; + _isFavorited = $v.isFavorited?.toBuilder(); + _isLiked = $v.isLiked?.toBuilder(); + _$v = null; + } + return this; + } + + @override + void replace(GPostFragmentData other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostFragmentData; + } + + @override + void update(void Function(GPostFragmentDataBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostFragmentData build() => _build(); + + _$GPostFragmentData _build() { + _$GPostFragmentData _$result; + try { + _$result = _$v ?? + new _$GPostFragmentData._( + G__typename: BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostFragmentData', 'G__typename'), + id: BuiltValueNullFieldError.checkNotNull( + id, r'GPostFragmentData', 'id'), + isFavorited: _isFavorited?.build(), + isLiked: _isLiked?.build()); + } catch (_) { + late String _$failedField; + try { + _$failedField = 'isFavorited'; + _isFavorited?.build(); + _$failedField = 'isLiked'; + _isLiked?.build(); + } catch (e) { + throw new BuiltValueNestedFieldError( + r'GPostFragmentData', _$failedField, e.toString()); + } + rethrow; + } + replace(_$result); + return _$result; + } +} + +class _$GPostFragmentData_isFavorited extends GPostFragmentData_isFavorited { + @override + final String G__typename; + @override + final int totalCount; + + factory _$GPostFragmentData_isFavorited( + [void Function(GPostFragmentData_isFavoritedBuilder)? updates]) => + (new GPostFragmentData_isFavoritedBuilder()..update(updates))._build(); + + _$GPostFragmentData_isFavorited._( + {required this.G__typename, required this.totalCount}) + : super._() { + BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostFragmentData_isFavorited', 'G__typename'); + BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostFragmentData_isFavorited', 'totalCount'); + } + + @override + GPostFragmentData_isFavorited rebuild( + void Function(GPostFragmentData_isFavoritedBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostFragmentData_isFavoritedBuilder toBuilder() => + new GPostFragmentData_isFavoritedBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostFragmentData_isFavorited && + G__typename == other.G__typename && + totalCount == other.totalCount; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, totalCount.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostFragmentData_isFavorited') + ..add('G__typename', G__typename) + ..add('totalCount', totalCount)) + .toString(); + } +} + +class GPostFragmentData_isFavoritedBuilder + implements + Builder { + _$GPostFragmentData_isFavorited? _$v; + + String? _G__typename; + String? get G__typename => _$this._G__typename; + set G__typename(String? G__typename) => _$this._G__typename = G__typename; + + int? _totalCount; + int? get totalCount => _$this._totalCount; + set totalCount(int? totalCount) => _$this._totalCount = totalCount; + + GPostFragmentData_isFavoritedBuilder() { + GPostFragmentData_isFavorited._initializeBuilder(this); + } + + GPostFragmentData_isFavoritedBuilder get _$this { + final $v = _$v; + if ($v != null) { + _G__typename = $v.G__typename; + _totalCount = $v.totalCount; + _$v = null; + } + return this; + } + + @override + void replace(GPostFragmentData_isFavorited other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostFragmentData_isFavorited; + } + + @override + void update(void Function(GPostFragmentData_isFavoritedBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostFragmentData_isFavorited build() => _build(); + + _$GPostFragmentData_isFavorited _build() { + final _$result = _$v ?? + new _$GPostFragmentData_isFavorited._( + G__typename: BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostFragmentData_isFavorited', 'G__typename'), + totalCount: BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostFragmentData_isFavorited', 'totalCount')); + replace(_$result); + return _$result; + } +} + +class _$GPostFragmentData_isLiked extends GPostFragmentData_isLiked { + @override + final String G__typename; + @override + final int totalCount; + + factory _$GPostFragmentData_isLiked( + [void Function(GPostFragmentData_isLikedBuilder)? updates]) => + (new GPostFragmentData_isLikedBuilder()..update(updates))._build(); + + _$GPostFragmentData_isLiked._( + {required this.G__typename, required this.totalCount}) + : super._() { + BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostFragmentData_isLiked', 'G__typename'); + BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostFragmentData_isLiked', 'totalCount'); + } + + @override + GPostFragmentData_isLiked rebuild( + void Function(GPostFragmentData_isLikedBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostFragmentData_isLikedBuilder toBuilder() => + new GPostFragmentData_isLikedBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostFragmentData_isLiked && + G__typename == other.G__typename && + totalCount == other.totalCount; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, totalCount.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostFragmentData_isLiked') + ..add('G__typename', G__typename) + ..add('totalCount', totalCount)) + .toString(); + } +} + +class GPostFragmentData_isLikedBuilder + implements + Builder { + _$GPostFragmentData_isLiked? _$v; + + String? _G__typename; + String? get G__typename => _$this._G__typename; + set G__typename(String? G__typename) => _$this._G__typename = G__typename; + + int? _totalCount; + int? get totalCount => _$this._totalCount; + set totalCount(int? totalCount) => _$this._totalCount = totalCount; + + GPostFragmentData_isLikedBuilder() { + GPostFragmentData_isLiked._initializeBuilder(this); + } + + GPostFragmentData_isLikedBuilder get _$this { + final $v = _$v; + if ($v != null) { + _G__typename = $v.G__typename; + _totalCount = $v.totalCount; + _$v = null; + } + return this; + } + + @override + void replace(GPostFragmentData_isLiked other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostFragmentData_isLiked; + } + + @override + void update(void Function(GPostFragmentData_isLikedBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostFragmentData_isLiked build() => _build(); + + _$GPostFragmentData_isLiked _build() { + final _$result = _$v ?? + new _$GPostFragmentData_isLiked._( + G__typename: BuiltValueNullFieldError.checkNotNull( + G__typename, r'GPostFragmentData_isLiked', 'G__typename'), + totalCount: BuiltValueNullFieldError.checkNotNull( + totalCount, r'GPostFragmentData_isLiked', 'totalCount')); + replace(_$result); + return _$result; + } +} + +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.dart b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.dart new file mode 100644 index 00000000..c759b717 --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:end_to_end_test/aliases/__generated__/alias_var_fragment.ast.gql.dart' + as _i2; +import 'package:end_to_end_test/aliases/__generated__/alias_var_fragment.var.gql.dart' + as _i3; +import 'package:end_to_end_test/graphql/__generated__/serializers.gql.dart' + as _i4; +import 'package:gql_exec/gql_exec.dart' as _i1; + +part 'alias_var_fragment.req.gql.g.dart'; + +abstract class GPosts implements Built { + GPosts._(); + + factory GPosts([Function(GPostsBuilder b) updates]) = _$GPosts; + + static void _initializeBuilder(GPostsBuilder b) => b + ..operation = _i1.Operation( + document: _i2.document, + operationName: 'Posts', + ); + _i3.GPostsVars get vars; + _i1.Operation get operation; + static Serializer get serializer => _$gPostsSerializer; + Map toJson() => (_i4.serializers.serializeWith( + GPosts.serializer, + this, + ) as Map); + static GPosts? fromJson(Map json) => + _i4.serializers.deserializeWith( + GPosts.serializer, + json, + ); +} diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.g.dart b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.g.dart new file mode 100644 index 00000000..0f8996ec --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.req.gql.g.dart @@ -0,0 +1,170 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'alias_var_fragment.req.gql.dart'; + +// ************************************************************************** +// BuiltValueGenerator +// ************************************************************************** + +Serializer _$gPostsSerializer = new _$GPostsSerializer(); + +class _$GPostsSerializer implements StructuredSerializer { + @override + final Iterable types = const [GPosts, _$GPosts]; + @override + final String wireName = 'GPosts'; + + @override + Iterable serialize(Serializers serializers, GPosts object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + 'vars', + serializers.serialize(object.vars, + specifiedType: const FullType(_i3.GPostsVars)), + 'operation', + serializers.serialize(object.operation, + specifiedType: const FullType(_i1.Operation)), + ]; + + return result; + } + + @override + GPosts deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostsBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case 'vars': + result.vars.replace(serializers.deserialize(value, + specifiedType: const FullType(_i3.GPostsVars))! + as _i3.GPostsVars); + break; + case 'operation': + result.operation = serializers.deserialize(value, + specifiedType: const FullType(_i1.Operation))! as _i1.Operation; + break; + } + } + + return result.build(); + } +} + +class _$GPosts extends GPosts { + @override + final _i3.GPostsVars vars; + @override + final _i1.Operation operation; + + factory _$GPosts([void Function(GPostsBuilder)? updates]) => + (new GPostsBuilder()..update(updates))._build(); + + _$GPosts._({required this.vars, required this.operation}) : super._() { + BuiltValueNullFieldError.checkNotNull(vars, r'GPosts', 'vars'); + BuiltValueNullFieldError.checkNotNull(operation, r'GPosts', 'operation'); + } + + @override + GPosts rebuild(void Function(GPostsBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostsBuilder toBuilder() => new GPostsBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPosts && + vars == other.vars && + operation == other.operation; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPosts') + ..add('vars', vars) + ..add('operation', operation)) + .toString(); + } +} + +class GPostsBuilder implements Builder { + _$GPosts? _$v; + + _i3.GPostsVarsBuilder? _vars; + _i3.GPostsVarsBuilder get vars => + _$this._vars ??= new _i3.GPostsVarsBuilder(); + set vars(_i3.GPostsVarsBuilder? vars) => _$this._vars = vars; + + _i1.Operation? _operation; + _i1.Operation? get operation => _$this._operation; + set operation(_i1.Operation? operation) => _$this._operation = operation; + + GPostsBuilder() { + GPosts._initializeBuilder(this); + } + + GPostsBuilder get _$this { + final $v = _$v; + if ($v != null) { + _vars = $v.vars.toBuilder(); + _operation = $v.operation; + _$v = null; + } + return this; + } + + @override + void replace(GPosts other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPosts; + } + + @override + void update(void Function(GPostsBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPosts build() => _build(); + + _$GPosts _build() { + _$GPosts _$result; + try { + _$result = _$v ?? + new _$GPosts._( + vars: vars.build(), + operation: BuiltValueNullFieldError.checkNotNull( + operation, r'GPosts', 'operation')); + } catch (_) { + late String _$failedField; + try { + _$failedField = 'vars'; + vars.build(); + } catch (e) { + throw new BuiltValueNestedFieldError( + r'GPosts', _$failedField, e.toString()); + } + rethrow; + } + replace(_$result); + return _$result; + } +} + +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.dart b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.dart new file mode 100644 index 00000000..b6b8a678 --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.dart @@ -0,0 +1,49 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:end_to_end_test/graphql/__generated__/serializers.gql.dart' + as _i1; + +part 'alias_var_fragment.var.gql.g.dart'; + +abstract class GPostsVars implements Built { + GPostsVars._(); + + factory GPostsVars([Function(GPostsVarsBuilder b) updates]) = _$GPostsVars; + + String get userId; + static Serializer get serializer => _$gPostsVarsSerializer; + Map toJson() => (_i1.serializers.serializeWith( + GPostsVars.serializer, + this, + ) as Map); + static GPostsVars? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostsVars.serializer, + json, + ); +} + +abstract class GPostFragmentVars + implements Built { + GPostFragmentVars._(); + + factory GPostFragmentVars([Function(GPostFragmentVarsBuilder b) updates]) = + _$GPostFragmentVars; + + String get userId; + static Serializer get serializer => + _$gPostFragmentVarsSerializer; + Map toJson() => (_i1.serializers.serializeWith( + GPostFragmentVars.serializer, + this, + ) as Map); + static GPostFragmentVars? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostFragmentVars.serializer, + json, + ); +} diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.g.dart b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.g.dart new file mode 100644 index 00000000..5a3b87ac --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/__generated__/alias_var_fragment.var.gql.g.dart @@ -0,0 +1,262 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'alias_var_fragment.var.gql.dart'; + +// ************************************************************************** +// BuiltValueGenerator +// ************************************************************************** + +Serializer _$gPostsVarsSerializer = new _$GPostsVarsSerializer(); +Serializer _$gPostFragmentVarsSerializer = + new _$GPostFragmentVarsSerializer(); + +class _$GPostsVarsSerializer implements StructuredSerializer { + @override + final Iterable types = const [GPostsVars, _$GPostsVars]; + @override + final String wireName = 'GPostsVars'; + + @override + Iterable serialize(Serializers serializers, GPostsVars object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + 'userId', + serializers.serialize(object.userId, + specifiedType: const FullType(String)), + ]; + + return result; + } + + @override + GPostsVars deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostsVarsBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case 'userId': + result.userId = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + } + } + + return result.build(); + } +} + +class _$GPostFragmentVarsSerializer + implements StructuredSerializer { + @override + final Iterable types = const [GPostFragmentVars, _$GPostFragmentVars]; + @override + final String wireName = 'GPostFragmentVars'; + + @override + Iterable serialize(Serializers serializers, GPostFragmentVars object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + 'userId', + serializers.serialize(object.userId, + specifiedType: const FullType(String)), + ]; + + return result; + } + + @override + GPostFragmentVars deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostFragmentVarsBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case 'userId': + result.userId = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + } + } + + return result.build(); + } +} + +class _$GPostsVars extends GPostsVars { + @override + final String userId; + + factory _$GPostsVars([void Function(GPostsVarsBuilder)? updates]) => + (new GPostsVarsBuilder()..update(updates))._build(); + + _$GPostsVars._({required this.userId}) : super._() { + BuiltValueNullFieldError.checkNotNull(userId, r'GPostsVars', 'userId'); + } + + @override + GPostsVars rebuild(void Function(GPostsVarsBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostsVarsBuilder toBuilder() => new GPostsVarsBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostsVars && userId == other.userId; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, userId.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostsVars')..add('userId', userId)) + .toString(); + } +} + +class GPostsVarsBuilder implements Builder { + _$GPostsVars? _$v; + + String? _userId; + String? get userId => _$this._userId; + set userId(String? userId) => _$this._userId = userId; + + GPostsVarsBuilder(); + + GPostsVarsBuilder get _$this { + final $v = _$v; + if ($v != null) { + _userId = $v.userId; + _$v = null; + } + return this; + } + + @override + void replace(GPostsVars other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostsVars; + } + + @override + void update(void Function(GPostsVarsBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostsVars build() => _build(); + + _$GPostsVars _build() { + final _$result = _$v ?? + new _$GPostsVars._( + userId: BuiltValueNullFieldError.checkNotNull( + userId, r'GPostsVars', 'userId')); + replace(_$result); + return _$result; + } +} + +class _$GPostFragmentVars extends GPostFragmentVars { + @override + final String userId; + + factory _$GPostFragmentVars( + [void Function(GPostFragmentVarsBuilder)? updates]) => + (new GPostFragmentVarsBuilder()..update(updates))._build(); + + _$GPostFragmentVars._({required this.userId}) : super._() { + BuiltValueNullFieldError.checkNotNull( + userId, r'GPostFragmentVars', 'userId'); + } + + @override + GPostFragmentVars rebuild(void Function(GPostFragmentVarsBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostFragmentVarsBuilder toBuilder() => + new GPostFragmentVarsBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostFragmentVars && userId == other.userId; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, userId.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostFragmentVars') + ..add('userId', userId)) + .toString(); + } +} + +class GPostFragmentVarsBuilder + implements Builder { + _$GPostFragmentVars? _$v; + + String? _userId; + String? get userId => _$this._userId; + set userId(String? userId) => _$this._userId = userId; + + GPostFragmentVarsBuilder(); + + GPostFragmentVarsBuilder get _$this { + final $v = _$v; + if ($v != null) { + _userId = $v.userId; + _$v = null; + } + return this; + } + + @override + void replace(GPostFragmentVars other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostFragmentVars; + } + + @override + void update(void Function(GPostFragmentVarsBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostFragmentVars build() => _build(); + + _$GPostFragmentVars _build() { + final _$result = _$v ?? + new _$GPostFragmentVars._( + userId: BuiltValueNullFieldError.checkNotNull( + userId, r'GPostFragmentVars', 'userId')); + replace(_$result); + return _$result; + } +} + +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.data.gql.g.dart b/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.data.gql.g.dart index ed85bfb5..6d82d8a2 100644 --- a/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.data.gql.g.dart @@ -253,8 +253,12 @@ class _$GAliasedHeroData extends GAliasedHeroData { @override int get hashCode { - return $jf($jc($jc($jc(0, G__typename.hashCode), empireHero.hashCode), - jediHero.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, empireHero.hashCode); + _$hash = $jc(_$hash, jediHero.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -394,9 +398,13 @@ class _$GAliasedHeroData_empireHero extends GAliasedHeroData_empireHero { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - from.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, from.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -542,9 +550,13 @@ class _$GAliasedHeroData_jediHero extends GAliasedHeroData_jediHero { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - from.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, from.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -638,4 +650,4 @@ class GAliasedHeroData_jediHeroBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.req.gql.g.dart b/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.req.gql.g.dart index 34ca12f5..3c44d30b 100644 --- a/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.req.gql.g.dart @@ -90,7 +90,11 @@ class _$GAliasedHero extends GAliasedHero { @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -167,4 +171,4 @@ class GAliasedHeroBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.var.gql.g.dart b/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.var.gql.g.dart index f40c47cc..89fe20ab 100644 --- a/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/aliases/__generated__/aliased_hero.var.gql.g.dart @@ -79,7 +79,10 @@ class _$GAliasedHeroVars extends GAliasedHeroVars { @override int get hashCode { - return $jf($jc(0, ep.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, ep.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -132,4 +135,4 @@ class GAliasedHeroVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql b/codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql new file mode 100644 index 00000000..52e41f29 --- /dev/null +++ b/codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql @@ -0,0 +1,15 @@ +fragment PostFragment on Post { + id + isFavorited: favoritedUsers(where: {id: $userId}){ + totalCount + } + isLiked: likedUsers(where: {id: $userId}){ + totalCount + } +} + +query Posts($userId: ID!) { + posts(userId: $userId) { + ...PostFragment + } +} \ No newline at end of file diff --git a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.data.gql.g.dart b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.data.gql.g.dart index 405b7551..b5005f79 100644 --- a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.data.gql.g.dart @@ -691,7 +691,11 @@ class _$GHeroWithFragmentsData extends GHeroWithFragmentsData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), hero.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, hero.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -819,10 +823,13 @@ class _$GHeroWithFragmentsData_hero extends GHeroWithFragmentsData_hero { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), - friendsConnection.hashCode), - name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, friendsConnection.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -965,8 +972,12 @@ class _$GHeroWithFragmentsData_hero_friendsConnection @override int get hashCode { - return $jf($jc($jc($jc(0, G__typename.hashCode), totalCount.hashCode), - edges.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, totalCount.hashCode); + _$hash = $jc(_$hash, edges.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1108,7 +1119,11 @@ class _$GHeroWithFragmentsData_hero_friendsConnection_edges @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), node.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, node.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1247,7 +1262,11 @@ class _$GHeroWithFragmentsData_hero_friendsConnection_edges_node @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1355,7 +1374,11 @@ class _$GheroDataData extends GheroDataData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1469,9 +1492,13 @@ class _$GcomparisonFieldsData extends GcomparisonFieldsData { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - friendsConnection.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, friendsConnection.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1610,8 +1637,12 @@ class _$GcomparisonFieldsData_friendsConnection @override int get hashCode { - return $jf($jc($jc($jc(0, G__typename.hashCode), totalCount.hashCode), - edges.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, totalCount.hashCode); + _$hash = $jc(_$hash, edges.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1745,7 +1776,11 @@ class _$GcomparisonFieldsData_friendsConnection_edges @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), node.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, node.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1879,7 +1914,11 @@ class _$GcomparisonFieldsData_friendsConnection_edges_node @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1950,4 +1989,4 @@ class GcomparisonFieldsData_friendsConnection_edges_nodeBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.req.gql.g.dart b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.req.gql.g.dart index 2c956ffb..075810ea 100644 --- a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.req.gql.g.dart @@ -96,7 +96,11 @@ class _$GHeroWithFragments extends GHeroWithFragments { @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -173,4 +177,4 @@ class GHeroWithFragmentsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.var.gql.g.dart b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.var.gql.g.dart index f1550823..dd38fb44 100644 --- a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_fragments.var.gql.g.dart @@ -156,7 +156,10 @@ class _$GHeroWithFragmentsVars extends GHeroWithFragmentsVars { @override int get hashCode { - return $jf($jc(0, first.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, first.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -291,7 +294,10 @@ class _$GcomparisonFieldsVars extends GcomparisonFieldsVars { @override int get hashCode { - return $jf($jc(0, first.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, first.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -342,4 +348,4 @@ class GcomparisonFieldsVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.data.gql.g.dart b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.data.gql.g.dart index c19d7668..20c08793 100644 --- a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.data.gql.g.dart @@ -919,7 +919,11 @@ class _$GHeroWithInterfaceSubTypedFragmentsData @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), hero.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, hero.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1052,8 +1056,12 @@ class _$GHeroWithInterfaceSubTypedFragmentsData_hero @override int get hashCode { - return $jf( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1173,8 +1181,12 @@ class _$GheroFieldsFragmentData__base extends GheroFieldsFragmentData__base { @override int get hashCode { - return $jf( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1302,10 +1314,14 @@ class _$GheroFieldsFragmentData__asHuman @override int get hashCode { - return $jf($jc( - $jc($jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - homePlanet.hashCode), - friends.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, homePlanet.hashCode); + _$hash = $jc(_$hash, friends.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1449,7 +1465,10 @@ class _$GheroFieldsFragmentData__asHuman_friends__base @override int get hashCode { - return $jf($jc(0, G__typename.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1569,9 +1588,13 @@ class _$GheroFieldsFragmentData__asHuman_friends__asDroid @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - primaryFunction.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, primaryFunction.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1715,9 +1738,13 @@ class _$GheroFieldsFragmentData__asHuman_friends__asHuman @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - homePlanet.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, homePlanet.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1853,9 +1880,13 @@ class _$GheroFieldsFragmentData__asDroid @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - primaryFunction.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, primaryFunction.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1976,8 +2007,12 @@ class _$GhumanFieldsFragmentData extends GhumanFieldsFragmentData { @override int get hashCode { - return $jf($jc($jc($jc(0, G__typename.hashCode), homePlanet.hashCode), - friends.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, homePlanet.hashCode); + _$hash = $jc(_$hash, friends.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -2099,7 +2134,10 @@ class _$GhumanFieldsFragmentData_friends__base @override int get hashCode { - return $jf($jc(0, G__typename.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -2212,9 +2250,13 @@ class _$GhumanFieldsFragmentData_friends__asDroid @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - primaryFunction.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, primaryFunction.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -2352,9 +2394,13 @@ class _$GhumanFieldsFragmentData_friends__asHuman @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode), - homePlanet.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, homePlanet.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -2474,7 +2520,11 @@ class _$GdroidFieldsFragmentData extends GdroidFieldsFragmentData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), primaryFunction.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, primaryFunction.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -2539,4 +2589,4 @@ class GdroidFieldsFragmentDataBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.req.gql.g.dart b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.req.gql.g.dart index b33b976f..39a20488 100644 --- a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.req.gql.g.dart @@ -107,7 +107,11 @@ class _$GHeroWithInterfaceSubTypedFragments @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -190,4 +194,4 @@ class GHeroWithInterfaceSubTypedFragmentsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.var.gql.g.dart b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.var.gql.g.dart index 039e22cd..ce583215 100644 --- a/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/fragments/__generated__/hero_with_interface_subtyped_fragments.var.gql.g.dart @@ -173,7 +173,10 @@ class _$GHeroWithInterfaceSubTypedFragmentsVars @override int get hashCode { - return $jf($jc(0, episode.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, episode.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -414,4 +417,4 @@ class GdroidFieldsFragmentVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/graphql/__generated__/schema.ast.gql.dart b/codegen/end_to_end_test/lib/graphql/__generated__/schema.ast.gql.dart index 118f4e7a..168241a6 100644 --- a/codegen/end_to_end_test/lib/graphql/__generated__/schema.ast.gql.dart +++ b/codegen/end_to_end_test/lib/graphql/__generated__/schema.ast.gql.dart @@ -183,6 +183,28 @@ const Query = _i1.ObjectTypeDefinitionNode( isNonNull: false, ), ), + _i1.FieldDefinitionNode( + name: _i1.NameNode(value: 'posts'), + directives: [], + args: [ + _i1.InputValueDefinitionNode( + name: _i1.NameNode(value: 'userId'), + directives: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'ID'), + isNonNull: true, + ), + defaultValue: null, + ) + ], + type: _i1.ListTypeNode( + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'Post'), + isNonNull: false, + ), + isNonNull: false, + ), + ), ], ); const Mutation = _i1.ObjectTypeDefinitionNode( @@ -907,6 +929,131 @@ const Starship = _i1.ObjectTypeDefinitionNode( ), ], ); +const Post = _i1.ObjectTypeDefinitionNode( + name: _i1.NameNode(value: 'Post'), + directives: [], + interfaces: [], + fields: [ + _i1.FieldDefinitionNode( + name: _i1.NameNode(value: 'id'), + directives: [], + args: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'ID'), + isNonNull: true, + ), + ), + _i1.FieldDefinitionNode( + name: _i1.NameNode(value: 'body'), + directives: [], + args: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'String'), + isNonNull: true, + ), + ), + _i1.FieldDefinitionNode( + name: _i1.NameNode(value: 'favoritedUsers'), + directives: [], + args: [ + _i1.InputValueDefinitionNode( + name: _i1.NameNode(value: 'where'), + directives: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'PostLikesInput'), + isNonNull: false, + ), + defaultValue: null, + ) + ], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'PostLikes'), + isNonNull: false, + ), + ), + _i1.FieldDefinitionNode( + name: _i1.NameNode(value: 'likedUsers'), + directives: [], + args: [ + _i1.InputValueDefinitionNode( + name: _i1.NameNode(value: 'where'), + directives: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'PostFavoritesInput'), + isNonNull: false, + ), + defaultValue: null, + ) + ], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'PostFavorites'), + isNonNull: false, + ), + ), + ], +); +const PostLikes = _i1.ObjectTypeDefinitionNode( + name: _i1.NameNode(value: 'PostLikes'), + directives: [], + interfaces: [], + fields: [ + _i1.FieldDefinitionNode( + name: _i1.NameNode(value: 'totalCount'), + directives: [], + args: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'Int'), + isNonNull: true, + ), + ) + ], +); +const PostFavorites = _i1.ObjectTypeDefinitionNode( + name: _i1.NameNode(value: 'PostFavorites'), + directives: [], + interfaces: [], + fields: [ + _i1.FieldDefinitionNode( + name: _i1.NameNode(value: 'totalCount'), + directives: [], + args: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'Int'), + isNonNull: true, + ), + ) + ], +); +const PostLikesInput = _i1.InputObjectTypeDefinitionNode( + name: _i1.NameNode(value: 'PostLikesInput'), + directives: [], + fields: [ + _i1.InputValueDefinitionNode( + name: _i1.NameNode(value: 'id'), + directives: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'ID'), + isNonNull: true, + ), + defaultValue: null, + ) + ], +); +const PostFavoritesInput = _i1.InputObjectTypeDefinitionNode( + name: _i1.NameNode(value: 'PostFavoritesInput'), + directives: [], + fields: [ + _i1.InputValueDefinitionNode( + name: _i1.NameNode(value: 'id'), + directives: [], + type: _i1.NamedTypeNode( + name: _i1.NameNode(value: 'ID'), + isNonNull: true, + ), + defaultValue: null, + ) + ], +); const SearchResult = _i1.UnionTypeDefinitionNode( name: _i1.NameNode(value: 'SearchResult'), directives: [], @@ -955,6 +1102,11 @@ const document = _i1.DocumentNode(definitions: [ ReviewInput, ColorInput, Starship, + Post, + PostLikes, + PostFavorites, + PostLikesInput, + PostFavoritesInput, SearchResult, Date, ISODate, diff --git a/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.dart b/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.dart index a84cdbf5..ef277200 100644 --- a/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.dart +++ b/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.dart @@ -85,6 +85,48 @@ abstract class GColorInput implements Built { ); } +abstract class GPostLikesInput + implements Built { + GPostLikesInput._(); + + factory GPostLikesInput([Function(GPostLikesInputBuilder b) updates]) = + _$GPostLikesInput; + + String get id; + static Serializer get serializer => + _$gPostLikesInputSerializer; + Map toJson() => (_i1.serializers.serializeWith( + GPostLikesInput.serializer, + this, + ) as Map); + static GPostLikesInput? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostLikesInput.serializer, + json, + ); +} + +abstract class GPostFavoritesInput + implements Built { + GPostFavoritesInput._(); + + factory GPostFavoritesInput( + [Function(GPostFavoritesInputBuilder b) updates]) = _$GPostFavoritesInput; + + String get id; + static Serializer get serializer => + _$gPostFavoritesInputSerializer; + Map toJson() => (_i1.serializers.serializeWith( + GPostFavoritesInput.serializer, + this, + ) as Map); + static GPostFavoritesInput? fromJson(Map json) => + _i1.serializers.deserializeWith( + GPostFavoritesInput.serializer, + json, + ); +} + abstract class GISODate implements Built { GISODate._(); diff --git a/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.g.dart b/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.g.dart index 9a393483..5187031b 100644 --- a/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.g.dart +++ b/codegen/end_to_end_test/lib/graphql/__generated__/schema.schema.gql.g.dart @@ -55,6 +55,10 @@ Serializer _$gLengthUnitSerializer = new _$GLengthUnitSerializer(); Serializer _$gReviewInputSerializer = new _$GReviewInputSerializer(); Serializer _$gColorInputSerializer = new _$GColorInputSerializer(); +Serializer _$gPostLikesInputSerializer = + new _$GPostLikesInputSerializer(); +Serializer _$gPostFavoritesInputSerializer = + new _$GPostFavoritesInputSerializer(); class _$GEpisodeSerializer implements PrimitiveSerializer { @override @@ -225,6 +229,92 @@ class _$GColorInputSerializer implements StructuredSerializer { } } +class _$GPostLikesInputSerializer + implements StructuredSerializer { + @override + final Iterable types = const [GPostLikesInput, _$GPostLikesInput]; + @override + final String wireName = 'GPostLikesInput'; + + @override + Iterable serialize(Serializers serializers, GPostLikesInput object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + 'id', + serializers.serialize(object.id, specifiedType: const FullType(String)), + ]; + + return result; + } + + @override + GPostLikesInput deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostLikesInputBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case 'id': + result.id = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + } + } + + return result.build(); + } +} + +class _$GPostFavoritesInputSerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + GPostFavoritesInput, + _$GPostFavoritesInput + ]; + @override + final String wireName = 'GPostFavoritesInput'; + + @override + Iterable serialize( + Serializers serializers, GPostFavoritesInput object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + 'id', + serializers.serialize(object.id, specifiedType: const FullType(String)), + ]; + + return result; + } + + @override + GPostFavoritesInput deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new GPostFavoritesInputBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case 'id': + result.id = serializers.deserialize(value, + specifiedType: const FullType(String))! as String; + break; + } + } + + return result.build(); + } +} + class _$GReviewInput extends GReviewInput { @override final int stars; @@ -263,10 +353,13 @@ class _$GReviewInput extends GReviewInput { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, stars.hashCode), commentary.hashCode), - favorite_color.hashCode), - seenOn.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, stars.hashCode); + _$hash = $jc(_$hash, commentary.hashCode); + _$hash = $jc(_$hash, favorite_color.hashCode); + _$hash = $jc(_$hash, seenOn.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -395,7 +488,12 @@ class _$GColorInput extends GColorInput { @override int get hashCode { - return $jf($jc($jc($jc(0, red.hashCode), green.hashCode), blue.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, red.hashCode); + _$hash = $jc(_$hash, green.hashCode); + _$hash = $jc(_$hash, blue.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -464,6 +562,174 @@ class GColorInputBuilder implements Builder { } } +class _$GPostLikesInput extends GPostLikesInput { + @override + final String id; + + factory _$GPostLikesInput([void Function(GPostLikesInputBuilder)? updates]) => + (new GPostLikesInputBuilder()..update(updates))._build(); + + _$GPostLikesInput._({required this.id}) : super._() { + BuiltValueNullFieldError.checkNotNull(id, r'GPostLikesInput', 'id'); + } + + @override + GPostLikesInput rebuild(void Function(GPostLikesInputBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostLikesInputBuilder toBuilder() => + new GPostLikesInputBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostLikesInput && id == other.id; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostLikesInput')..add('id', id)) + .toString(); + } +} + +class GPostLikesInputBuilder + implements Builder { + _$GPostLikesInput? _$v; + + String? _id; + String? get id => _$this._id; + set id(String? id) => _$this._id = id; + + GPostLikesInputBuilder(); + + GPostLikesInputBuilder get _$this { + final $v = _$v; + if ($v != null) { + _id = $v.id; + _$v = null; + } + return this; + } + + @override + void replace(GPostLikesInput other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostLikesInput; + } + + @override + void update(void Function(GPostLikesInputBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostLikesInput build() => _build(); + + _$GPostLikesInput _build() { + final _$result = _$v ?? + new _$GPostLikesInput._( + id: BuiltValueNullFieldError.checkNotNull( + id, r'GPostLikesInput', 'id')); + replace(_$result); + return _$result; + } +} + +class _$GPostFavoritesInput extends GPostFavoritesInput { + @override + final String id; + + factory _$GPostFavoritesInput( + [void Function(GPostFavoritesInputBuilder)? updates]) => + (new GPostFavoritesInputBuilder()..update(updates))._build(); + + _$GPostFavoritesInput._({required this.id}) : super._() { + BuiltValueNullFieldError.checkNotNull(id, r'GPostFavoritesInput', 'id'); + } + + @override + GPostFavoritesInput rebuild( + void Function(GPostFavoritesInputBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + GPostFavoritesInputBuilder toBuilder() => + new GPostFavoritesInputBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is GPostFavoritesInput && id == other.id; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'GPostFavoritesInput')..add('id', id)) + .toString(); + } +} + +class GPostFavoritesInputBuilder + implements Builder { + _$GPostFavoritesInput? _$v; + + String? _id; + String? get id => _$this._id; + set id(String? id) => _$this._id = id; + + GPostFavoritesInputBuilder(); + + GPostFavoritesInputBuilder get _$this { + final $v = _$v; + if ($v != null) { + _id = $v.id; + _$v = null; + } + return this; + } + + @override + void replace(GPostFavoritesInput other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$GPostFavoritesInput; + } + + @override + void update(void Function(GPostFavoritesInputBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + GPostFavoritesInput build() => _build(); + + _$GPostFavoritesInput _build() { + final _$result = _$v ?? + new _$GPostFavoritesInput._( + id: BuiltValueNullFieldError.checkNotNull( + id, r'GPostFavoritesInput', 'id')); + replace(_$result); + return _$result; + } +} + class _$GISODate extends GISODate { @override final String value; @@ -490,7 +756,10 @@ class _$GISODate extends GISODate { @override int get hashCode { - return $jf($jc(0, value.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, value.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -542,4 +811,4 @@ class GISODateBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.dart b/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.dart index 28626ae9..4dc390c8 100644 --- a/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.dart +++ b/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.dart @@ -1,6 +1,19 @@ import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; import 'package:built_value/standard_json_plugin.dart' show StandardJsonPlugin; +import 'package:end_to_end_test/aliases/__generated__/alias_var_fragment.data.gql.dart' + show + GPostFragmentData, + GPostFragmentData_isFavorited, + GPostFragmentData_isLiked, + GPostsData, + GPostsData_posts, + GPostsData_posts_isFavorited, + GPostsData_posts_isLiked; +import 'package:end_to_end_test/aliases/__generated__/alias_var_fragment.req.gql.dart' + show GPosts; +import 'package:end_to_end_test/aliases/__generated__/alias_var_fragment.var.gql.dart' + show GPostFragmentVars, GPostsVars; import 'package:end_to_end_test/aliases/__generated__/aliased_hero.data.gql.dart' show GAliasedHeroData, @@ -57,7 +70,14 @@ import 'package:end_to_end_test/fragments/__generated__/hero_with_interface_subt GheroFieldsFragmentVars, GhumanFieldsFragmentVars; import 'package:end_to_end_test/graphql/__generated__/schema.schema.gql.dart' - show GColorInput, GEpisode, GISODate, GLengthUnit, GReviewInput; + show + GColorInput, + GEpisode, + GISODate, + GLengthUnit, + GPostFavoritesInput, + GPostLikesInput, + GReviewInput; import 'package:end_to_end_test/interfaces/__generated__/hero_for_episode.data.gql.dart' show GHeroForEpisodeData_hero, @@ -151,6 +171,18 @@ final SerializersBuilder _serializersBuilder = _$serializers.toBuilder() GHumanWithArgsVars, GISODate, GLengthUnit, + GPostFavoritesInput, + GPostFragmentData, + GPostFragmentData_isFavorited, + GPostFragmentData_isLiked, + GPostFragmentVars, + GPostLikesInput, + GPosts, + GPostsData, + GPostsData_posts, + GPostsData_posts_isFavorited, + GPostsData_posts_isLiked, + GPostsVars, GReviewInput, GReviewWithDate, GReviewWithDateData, diff --git a/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.g.dart b/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.g.dart index 4a6a2114..894a3418 100644 --- a/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.g.dart +++ b/codegen/end_to_end_test/lib/graphql/__generated__/serializers.gql.g.dart @@ -48,6 +48,18 @@ Serializers _$serializers = (new Serializers().toBuilder() ..add(GHumanWithArgsVars.serializer) ..add(GISODate.serializer) ..add(GLengthUnit.serializer) + ..add(GPostFavoritesInput.serializer) + ..add(GPostFragmentData.serializer) + ..add(GPostFragmentData_isFavorited.serializer) + ..add(GPostFragmentData_isLiked.serializer) + ..add(GPostFragmentVars.serializer) + ..add(GPostLikesInput.serializer) + ..add(GPosts.serializer) + ..add(GPostsData.serializer) + ..add(GPostsData_posts.serializer) + ..add(GPostsData_posts_isFavorited.serializer) + ..add(GPostsData_posts_isLiked.serializer) + ..add(GPostsVars.serializer) ..add(GReviewInput.serializer) ..add(GReviewWithDate.serializer) ..add(GReviewWithDateData.serializer) @@ -106,6 +118,10 @@ Serializers _$serializers = (new Serializers().toBuilder() ]), () => new ListBuilder< GHeroWithFragmentsData_hero_friendsConnection_edges?>()) + ..addBuilderFactory( + const FullType( + BuiltList, const [const FullType.nullable(GPostsData_posts)]), + () => new ListBuilder()) ..addBuilderFactory( const FullType(BuiltList, const [ const FullType.nullable( @@ -125,4 +141,4 @@ Serializers _$serializers = (new Serializers().toBuilder() () => new ListBuilder())) .build(); -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/graphql/schema.graphql b/codegen/end_to_end_test/lib/graphql/schema.graphql index c95faa8f..708e82f7 100644 --- a/codegen/end_to_end_test/lib/graphql/schema.graphql +++ b/codegen/end_to_end_test/lib/graphql/schema.graphql @@ -18,6 +18,7 @@ type Query { droid(id: ID!): Droid human(id: ID!): Human starship(id: ID!): Starship + posts(userId: ID!): [Post] } # The mutation type, represents all updates we can make to our data @@ -174,6 +175,29 @@ type Starship { coordinates: [[Float!]!] } +type Post { + id: ID! + body: String! + favoritedUsers(where: PostLikesInput): PostLikes + likedUsers(where: PostFavoritesInput): PostFavorites +} + +type PostLikes { + totalCount: Int! +} + +type PostFavorites { + totalCount: Int! +} + +input PostLikesInput { + id: ID! +} + +input PostFavoritesInput { + id: ID! +} + union SearchResult = Human | Droid | Starship scalar Date diff --git a/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.data.gql.g.dart b/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.data.gql.g.dart index 3fa28c16..ee58bc38 100644 --- a/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.data.gql.g.dart @@ -419,7 +419,11 @@ class _$GHeroForEpisodeData extends GHeroForEpisodeData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), hero.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, hero.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -523,8 +527,12 @@ class _$GHeroForEpisodeData_hero__base extends GHeroForEpisodeData_hero__base { @override int get hashCode { - return $jf($jc( - $jc($jc(0, G__typename.hashCode), name.hashCode), friends.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, friends.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -655,7 +663,11 @@ class _$GHeroForEpisodeData_hero__base_friends @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -772,9 +784,13 @@ class _$GHeroForEpisodeData_hero__asDroid @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), name.hashCode), friends.hashCode), - primaryFunction.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, friends.hashCode); + _$hash = $jc(_$hash, primaryFunction.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -915,7 +931,11 @@ class _$GHeroForEpisodeData_hero__asDroid_friends @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1019,7 +1039,11 @@ class _$GDroidFragmentData extends GDroidFragmentData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), primaryFunction.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, primaryFunction.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -1083,4 +1107,4 @@ class GDroidFragmentDataBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.req.gql.g.dart b/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.req.gql.g.dart index 62c43d0e..fbeddc86 100644 --- a/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.req.gql.g.dart @@ -93,7 +93,11 @@ class _$GHeroForEpisode extends GHeroForEpisode { @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -170,4 +174,4 @@ class GHeroForEpisodeBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.var.gql.g.dart b/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.var.gql.g.dart index 89ab68f7..4de27c1d 100644 --- a/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/interfaces/__generated__/hero_for_episode.var.gql.g.dart @@ -108,7 +108,10 @@ class _$GHeroForEpisodeVars extends GHeroForEpisodeVars { @override int get hashCode { - return $jf($jc(0, ep.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, ep.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -221,4 +224,4 @@ class GDroidFragmentVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.data.gql.g.dart b/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.data.gql.g.dart index a98b4caf..849ff651 100644 --- a/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.data.gql.g.dart @@ -155,7 +155,11 @@ class _$GHeroNoVarsData extends GHeroNoVarsData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), hero.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, hero.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -274,8 +278,12 @@ class _$GHeroNoVarsData_hero extends GHeroNoVarsData_hero { @override int get hashCode { - return $jf( - $jc($jc($jc(0, G__typename.hashCode), id.hashCode), name.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -347,4 +355,4 @@ class GHeroNoVarsData_heroBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.req.gql.g.dart b/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.req.gql.g.dart index ac4dc32c..d42882c5 100644 --- a/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.req.gql.g.dart @@ -88,7 +88,11 @@ class _$GHeroNoVars extends GHeroNoVars { @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -164,4 +168,4 @@ class GHeroNoVarsBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.var.gql.g.dart b/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.var.gql.g.dart index 4b0f9bbc..c98b3a7e 100644 --- a/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/no_vars/__generated__/hero_no_vars.var.gql.g.dart @@ -88,4 +88,4 @@ class GHeroNoVarsVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.data.gql.g.dart b/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.data.gql.g.dart index 1d688b3b..dd131b05 100644 --- a/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.data.gql.g.dart @@ -211,7 +211,11 @@ class _$GReviewWithDateData extends GReviewWithDateData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), createReview.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, createReview.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -353,16 +357,16 @@ class _$GReviewWithDateData_createReview @override int get hashCode { - return $jf($jc( - $jc( - $jc( - $jc( - $jc($jc($jc(0, G__typename.hashCode), episode.hashCode), - stars.hashCode), - commentary.hashCode), - createdAt.hashCode), - seenOn.hashCode), - custom.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, episode.hashCode); + _$hash = $jc(_$hash, stars.hashCode); + _$hash = $jc(_$hash, commentary.hashCode); + _$hash = $jc(_$hash, createdAt.hashCode); + _$hash = $jc(_$hash, seenOn.hashCode); + _$hash = $jc(_$hash, custom.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -480,4 +484,4 @@ class GReviewWithDateData_createReviewBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.req.gql.g.dart b/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.req.gql.g.dart index 8243b548..91d79828 100644 --- a/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.req.gql.g.dart @@ -93,7 +93,11 @@ class _$GReviewWithDate extends GReviewWithDate { @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -170,4 +174,4 @@ class GReviewWithDateBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.var.gql.g.dart b/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.var.gql.g.dart index b02235e2..7663a833 100644 --- a/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/scalars/__generated__/review_with_date.var.gql.g.dart @@ -116,8 +116,12 @@ class _$GReviewWithDateVars extends GReviewWithDateVars { @override int get hashCode { - return $jf($jc( - $jc($jc(0, episode.hashCode), review.hashCode), createdAt.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, episode.hashCode); + _$hash = $jc(_$hash, review.hashCode); + _$hash = $jc(_$hash, createdAt.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -196,4 +200,4 @@ class GReviewWithDateVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/variables/__generated__/create_review.data.gql.g.dart b/codegen/end_to_end_test/lib/variables/__generated__/create_review.data.gql.g.dart index bfa657d0..9a91b574 100644 --- a/codegen/end_to_end_test/lib/variables/__generated__/create_review.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/variables/__generated__/create_review.data.gql.g.dart @@ -175,7 +175,11 @@ class _$GCreateReviewData extends GCreateReviewData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), createReview.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, createReview.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -300,10 +304,13 @@ class _$GCreateReviewData_createReview extends GCreateReviewData_createReview { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, G__typename.hashCode), episode.hashCode), - stars.hashCode), - commentary.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, episode.hashCode); + _$hash = $jc(_$hash, stars.hashCode); + _$hash = $jc(_$hash, commentary.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -383,4 +390,4 @@ class GCreateReviewData_createReviewBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/variables/__generated__/create_review.req.gql.g.dart b/codegen/end_to_end_test/lib/variables/__generated__/create_review.req.gql.g.dart index f3137423..a8262c04 100644 --- a/codegen/end_to_end_test/lib/variables/__generated__/create_review.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/variables/__generated__/create_review.req.gql.g.dart @@ -90,7 +90,11 @@ class _$GCreateReview extends GCreateReview { @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -167,4 +171,4 @@ class GCreateReviewBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/variables/__generated__/create_review.var.gql.g.dart b/codegen/end_to_end_test/lib/variables/__generated__/create_review.var.gql.g.dart index c697e3d7..1077ab97 100644 --- a/codegen/end_to_end_test/lib/variables/__generated__/create_review.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/variables/__generated__/create_review.var.gql.g.dart @@ -96,7 +96,11 @@ class _$GCreateReviewVars extends GCreateReviewVars { @override int get hashCode { - return $jf($jc($jc(0, episode.hashCode), review.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, episode.hashCode); + _$hash = $jc(_$hash, review.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -168,4 +172,4 @@ class GCreateReviewVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.data.gql.g.dart b/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.data.gql.g.dart index 45f31eee..4557ba55 100644 --- a/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.data.gql.g.dart +++ b/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.data.gql.g.dart @@ -163,7 +163,11 @@ class _$GHumanWithArgsData extends GHumanWithArgsData { @override int get hashCode { - return $jf($jc($jc(0, G__typename.hashCode), human.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, human.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -281,8 +285,12 @@ class _$GHumanWithArgsData_human extends GHumanWithArgsData_human { @override int get hashCode { - return $jf( - $jc($jc($jc(0, G__typename.hashCode), name.hashCode), height.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, G__typename.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, height.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -354,4 +362,4 @@ class GHumanWithArgsData_humanBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.req.gql.g.dart b/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.req.gql.g.dart index 438ef3b0..4b085286 100644 --- a/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.req.gql.g.dart +++ b/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.req.gql.g.dart @@ -93,7 +93,11 @@ class _$GHumanWithArgs extends GHumanWithArgs { @override int get hashCode { - return $jf($jc($jc(0, vars.hashCode), operation.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, vars.hashCode); + _$hash = $jc(_$hash, operation.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -170,4 +174,4 @@ class GHumanWithArgsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.var.gql.g.dart b/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.var.gql.g.dart index e36ddcb1..af283a73 100644 --- a/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.var.gql.g.dart +++ b/codegen/end_to_end_test/lib/variables/__generated__/human_with_args.var.gql.g.dart @@ -80,7 +80,10 @@ class _$GHumanWithArgsVars extends GHumanWithArgsVars { @override int get hashCode { - return $jf($jc(0, id.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -133,4 +136,4 @@ class GHumanWithArgsVarsBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/codegen/gql_code_builder/lib/src/frag_vars.dart b/codegen/gql_code_builder/lib/src/frag_vars.dart index 768b5da2..f1bd1213 100644 --- a/codegen/gql_code_builder/lib/src/frag_vars.dart +++ b/codegen/gql_code_builder/lib/src/frag_vars.dart @@ -1,3 +1,4 @@ +import 'package:collection/collection.dart'; import "package:gql/ast.dart"; import "./common.dart"; @@ -7,13 +8,17 @@ Map fragmentVarTypes({ required FragmentDefinitionNode fragment, required Map fragmentMap, required DocumentNode schema, -}) => - _varTypesForSelections( - fragmentMap: fragmentMap, - selections: fragment.selectionSet.selections, - parentType: fragment.typeCondition.on, - schema: schema, - ); +}) { + print("fragmentVarTypes: ${fragment.name.value}"); + final result = _varTypesForSelections( + fragmentMap: fragmentMap, + selections: fragment.selectionSet.selections, + parentType: fragment.typeCondition.on, + schema: schema, + ); + print("fragmentVarTypes: ${fragment.name.value} ${result.keys.map((e) => e.value).toList()}"); + return result; +} Map _varTypesForSelections({ required List selections, @@ -57,8 +62,7 @@ Map _varTypesForSelections({ } else if (selection is FragmentSpreadNode) { final fragment = fragmentMap[selection.name.value]; if (fragment == null) { - throw Exception( - "Missing fragment definition for ${selection.name.value}"); + throw Exception("Missing fragment definition for ${selection.name.value}"); } return { ...argMap, @@ -90,12 +94,46 @@ Map _varTypesForField({ return { for (final arg in field.arguments) if (arg.value is VariableNode) - arg.name: fieldDef.args - .firstWhere((inputVal) => inputVal.name == arg.name) - .type + arg.name: fieldDef.args.firstWhere((inputVal) => inputVal.name == arg.name).type + else if (arg.value is ObjectValueNode) + ..._varTypesForObjectValue( + argName: arg.name, + objectValue: arg.value as ObjectValueNode, + schema: schema, + parentType: unwrapTypeNode( + fieldDef.args.firstWhere((inputVal) => inputVal.name == arg.name).type), + ) }; } +Map _varTypesForObjectValue({ + required NameNode argName, + required ObjectValueNode objectValue, + required DocumentNode schema, + required NamedTypeNode parentType, +}) { + final parentTypeDef = getTypeDefinitionNode(schema, parentType.name.value); + + if (parentTypeDef is InputObjectTypeDefinitionNode) { + return { + for (final field in objectValue.fields) + if (field.value is VariableNode) + (field.value as VariableNode).name: + parentTypeDef.fields.firstWhere((inputVal) => inputVal.name == field.name).type + else if (field.value is ObjectValueNode) + ..._varTypesForObjectValue( + argName: field.name, + objectValue: field.value as ObjectValueNode, + schema: schema, + parentType: unwrapTypeNode( + parentTypeDef.fields.firstWhere((inputVal) => inputVal.name == field.name).type), + ) + }; + } + throw Exception( + "Parent type definition '${parentTypeDef.runtimeType}' is not an ObjectTypeDefinitionNode"); +} + /// Given a field from a query, fetches the field's definition from the schema FieldDefinitionNode _fieldDefinition({ required FieldNode field, From 6d992219c53a84f779bd4f1c0e69738acf25a473 Mon Sep 17 00:00:00 2001 From: Martin Kamleithner Date: Sat, 11 Feb 2023 00:48:27 +0100 Subject: [PATCH 6/8] format --- .../gql_code_builder/lib/src/frag_vars.dart | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/codegen/gql_code_builder/lib/src/frag_vars.dart b/codegen/gql_code_builder/lib/src/frag_vars.dart index f1bd1213..8ebdead3 100644 --- a/codegen/gql_code_builder/lib/src/frag_vars.dart +++ b/codegen/gql_code_builder/lib/src/frag_vars.dart @@ -16,7 +16,8 @@ Map fragmentVarTypes({ parentType: fragment.typeCondition.on, schema: schema, ); - print("fragmentVarTypes: ${fragment.name.value} ${result.keys.map((e) => e.value).toList()}"); + print( + "fragmentVarTypes: ${fragment.name.value} ${result.keys.map((e) => e.value).toList()}"); return result; } @@ -62,7 +63,8 @@ Map _varTypesForSelections({ } else if (selection is FragmentSpreadNode) { final fragment = fragmentMap[selection.name.value]; if (fragment == null) { - throw Exception("Missing fragment definition for ${selection.name.value}"); + throw Exception( + "Missing fragment definition for ${selection.name.value}"); } return { ...argMap, @@ -94,14 +96,17 @@ Map _varTypesForField({ return { for (final arg in field.arguments) if (arg.value is VariableNode) - arg.name: fieldDef.args.firstWhere((inputVal) => inputVal.name == arg.name).type + arg.name: fieldDef.args + .firstWhere((inputVal) => inputVal.name == arg.name) + .type else if (arg.value is ObjectValueNode) ..._varTypesForObjectValue( argName: arg.name, objectValue: arg.value as ObjectValueNode, schema: schema, - parentType: unwrapTypeNode( - fieldDef.args.firstWhere((inputVal) => inputVal.name == arg.name).type), + parentType: unwrapTypeNode(fieldDef.args + .firstWhere((inputVal) => inputVal.name == arg.name) + .type), ) }; } @@ -118,15 +123,17 @@ Map _varTypesForObjectValue({ return { for (final field in objectValue.fields) if (field.value is VariableNode) - (field.value as VariableNode).name: - parentTypeDef.fields.firstWhere((inputVal) => inputVal.name == field.name).type + (field.value as VariableNode).name: parentTypeDef.fields + .firstWhere((inputVal) => inputVal.name == field.name) + .type else if (field.value is ObjectValueNode) ..._varTypesForObjectValue( argName: field.name, objectValue: field.value as ObjectValueNode, schema: schema, - parentType: unwrapTypeNode( - parentTypeDef.fields.firstWhere((inputVal) => inputVal.name == field.name).type), + parentType: unwrapTypeNode(parentTypeDef.fields + .firstWhere((inputVal) => inputVal.name == field.name) + .type), ) }; } From bc98ab02aa6286cd656e0b8811dca21ce3957ec1 Mon Sep 17 00:00:00 2001 From: Martin Kamleithner Date: Sat, 11 Feb 2023 15:31:25 +0100 Subject: [PATCH 7/8] refactor --- .../lib/aliases/alias_var_fragment.graphql | 4 +- .../gql_code_builder/lib/src/frag_vars.dart | 45 ++++++++----------- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql b/codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql index 52e41f29..6d4edc61 100644 --- a/codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql +++ b/codegen/end_to_end_test/lib/aliases/alias_var_fragment.graphql @@ -1,9 +1,9 @@ fragment PostFragment on Post { id - isFavorited: favoritedUsers(where: {id: $userId}){ + isFavorited: favoritedUsers(where: {id: $userId}) { totalCount } - isLiked: likedUsers(where: {id: $userId}){ + isLiked: likedUsers(where: {id: $userId}) { totalCount } } diff --git a/codegen/gql_code_builder/lib/src/frag_vars.dart b/codegen/gql_code_builder/lib/src/frag_vars.dart index 8ebdead3..8dfa69ae 100644 --- a/codegen/gql_code_builder/lib/src/frag_vars.dart +++ b/codegen/gql_code_builder/lib/src/frag_vars.dart @@ -1,4 +1,3 @@ -import 'package:collection/collection.dart'; import "package:gql/ast.dart"; import "./common.dart"; @@ -8,18 +7,13 @@ Map fragmentVarTypes({ required FragmentDefinitionNode fragment, required Map fragmentMap, required DocumentNode schema, -}) { - print("fragmentVarTypes: ${fragment.name.value}"); - final result = _varTypesForSelections( - fragmentMap: fragmentMap, - selections: fragment.selectionSet.selections, - parentType: fragment.typeCondition.on, - schema: schema, - ); - print( - "fragmentVarTypes: ${fragment.name.value} ${result.keys.map((e) => e.value).toList()}"); - return result; -} +}) => + _varTypesForSelections( + fragmentMap: fragmentMap, + selections: fragment.selectionSet.selections, + parentType: fragment.typeCondition.on, + schema: schema, + ); Map _varTypesForSelections({ required List selections, @@ -63,8 +57,7 @@ Map _varTypesForSelections({ } else if (selection is FragmentSpreadNode) { final fragment = fragmentMap[selection.name.value]; if (fragment == null) { - throw Exception( - "Missing fragment definition for ${selection.name.value}"); + throw Exception("Missing fragment definition for ${selection.name.value}"); } return { ...argMap, @@ -96,21 +89,21 @@ Map _varTypesForField({ return { for (final arg in field.arguments) if (arg.value is VariableNode) - arg.name: fieldDef.args - .firstWhere((inputVal) => inputVal.name == arg.name) - .type + arg.name: fieldDef.args.firstWhere((inputVal) => inputVal.name == arg.name).type else if (arg.value is ObjectValueNode) ..._varTypesForObjectValue( argName: arg.name, objectValue: arg.value as ObjectValueNode, schema: schema, - parentType: unwrapTypeNode(fieldDef.args - .firstWhere((inputVal) => inputVal.name == arg.name) - .type), + parentType: unwrapTypeNode( + fieldDef.args.firstWhere((inputVal) => inputVal.name == arg.name).type), ) }; } +/// Returns a map of a field's argument variables from a nested object to their respective types from the schema +/// e.g. when used like this: { foo(bar: { baz: $baz }) } +/// the returned map would be { baz: } Map _varTypesForObjectValue({ required NameNode argName, required ObjectValueNode objectValue, @@ -123,17 +116,15 @@ Map _varTypesForObjectValue({ return { for (final field in objectValue.fields) if (field.value is VariableNode) - (field.value as VariableNode).name: parentTypeDef.fields - .firstWhere((inputVal) => inputVal.name == field.name) - .type + (field.value as VariableNode).name: + parentTypeDef.fields.firstWhere((inputVal) => inputVal.name == field.name).type else if (field.value is ObjectValueNode) ..._varTypesForObjectValue( argName: field.name, objectValue: field.value as ObjectValueNode, schema: schema, - parentType: unwrapTypeNode(parentTypeDef.fields - .firstWhere((inputVal) => inputVal.name == field.name) - .type), + parentType: unwrapTypeNode( + parentTypeDef.fields.firstWhere((inputVal) => inputVal.name == field.name).type), ) }; } From 7ec5c9e5e4266acdac180bc484f19749c4c0000a Mon Sep 17 00:00:00 2001 From: Martin Kamleithner Date: Sat, 11 Feb 2023 18:27:21 +0100 Subject: [PATCH 8/8] fmt --- .../gql_code_builder/lib/src/frag_vars.dart | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/codegen/gql_code_builder/lib/src/frag_vars.dart b/codegen/gql_code_builder/lib/src/frag_vars.dart index 8dfa69ae..d12377e9 100644 --- a/codegen/gql_code_builder/lib/src/frag_vars.dart +++ b/codegen/gql_code_builder/lib/src/frag_vars.dart @@ -57,7 +57,8 @@ Map _varTypesForSelections({ } else if (selection is FragmentSpreadNode) { final fragment = fragmentMap[selection.name.value]; if (fragment == null) { - throw Exception("Missing fragment definition for ${selection.name.value}"); + throw Exception( + "Missing fragment definition for ${selection.name.value}"); } return { ...argMap, @@ -89,14 +90,17 @@ Map _varTypesForField({ return { for (final arg in field.arguments) if (arg.value is VariableNode) - arg.name: fieldDef.args.firstWhere((inputVal) => inputVal.name == arg.name).type + arg.name: fieldDef.args + .firstWhere((inputVal) => inputVal.name == arg.name) + .type else if (arg.value is ObjectValueNode) ..._varTypesForObjectValue( argName: arg.name, objectValue: arg.value as ObjectValueNode, schema: schema, - parentType: unwrapTypeNode( - fieldDef.args.firstWhere((inputVal) => inputVal.name == arg.name).type), + parentType: unwrapTypeNode(fieldDef.args + .firstWhere((inputVal) => inputVal.name == arg.name) + .type), ) }; } @@ -116,15 +120,17 @@ Map _varTypesForObjectValue({ return { for (final field in objectValue.fields) if (field.value is VariableNode) - (field.value as VariableNode).name: - parentTypeDef.fields.firstWhere((inputVal) => inputVal.name == field.name).type + (field.value as VariableNode).name: parentTypeDef.fields + .firstWhere((inputVal) => inputVal.name == field.name) + .type else if (field.value is ObjectValueNode) ..._varTypesForObjectValue( argName: field.name, objectValue: field.value as ObjectValueNode, schema: schema, - parentType: unwrapTypeNode( - parentTypeDef.fields.firstWhere((inputVal) => inputVal.name == field.name).type), + parentType: unwrapTypeNode(parentTypeDef.fields + .firstWhere((inputVal) => inputVal.name == field.name) + .type), ) }; }