diff --git a/CHANGELOG.md b/CHANGELOG.md index 2463d3bd..043bd87b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 7.0.0-beta.10 + +- union generation fix for https://github.com/comigor/artemis/issues/284 + ## 7.0.0-beta.9 - nullable scalar_mapping types diff --git a/lib/generator.dart b/lib/generator.dart index 8eae5cb1..d07f74f0 100644 --- a/lib/generator.dart +++ b/lib/generator.dart @@ -1,5 +1,6 @@ import 'package:artemis/generator/data/data.dart'; import 'package:artemis/generator/data/enum_value_definition.dart'; +import 'package:artemis/generator/data/nullable.dart'; import 'package:artemis/visitor/canonical_visitor.dart'; import 'package:artemis/visitor/generator_visitor.dart'; import 'package:artemis/visitor/object_type_definition_visitor.dart'; @@ -179,19 +180,15 @@ Iterable generateDefinitions( .value ?? suffix; - // if (rootTypeName == null) { - // throw Exception( - // '''No root type was found for ${operation.type} $operationName.'''); - // } - final TypeDefinitionNode parentType = objectVisitor.getByName(rootTypeName)!; final name = QueryName.fromPath( - path: createPathName([ - ClassName(name: operationName), - ClassName(name: parentType.name.value) - ], schemaMap.namingScheme)); + path: createPathName([ + ClassName(name: operationName), + ClassName(name: parentType.name.value) + ], schemaMap.namingScheme), + ); final context = Context( schema: schema, @@ -298,8 +295,7 @@ ClassProperty createClassProperty({ Make sure your query is correct and your schema is updated.'''); } - final nextType = - gql.getTypeByName(context.schema, fieldType, context: 'field node'); + final nextType = gql.getTypeByName(context.schema, fieldType); final aliasedContext = context.withAlias( nextFieldName: fieldName, @@ -335,6 +331,7 @@ Make sure your query is correct and your schema is updated.'''); nextFieldName: nextFieldName, nextClassName: ClassName(name: nextType.name.value), alias: fieldAlias, + ofUnion: Nullable(null), ), ); } diff --git a/lib/generator/data/nullable.dart b/lib/generator/data/nullable.dart new file mode 100644 index 00000000..049c9f3b --- /dev/null +++ b/lib/generator/data/nullable.dart @@ -0,0 +1,12 @@ +/// Allows to reset values back to null in `copyWith` pattern +class Nullable { + final T _value; + + /// Sets desired value + Nullable(this._value); + + /// Gets the real value + T get value { + return _value; + } +} diff --git a/lib/generator/ephemeral_data.dart b/lib/generator/ephemeral_data.dart index c30dd36e..6734b60a 100644 --- a/lib/generator/ephemeral_data.dart +++ b/lib/generator/ephemeral_data.dart @@ -1,4 +1,5 @@ import 'package:artemis/generator/data/data.dart'; +import 'package:artemis/generator/data/nullable.dart'; import 'package:gql/ast.dart'; import '../schema/options.dart'; @@ -113,7 +114,7 @@ class Context { required TypeDefinitionNode nextType, required Name? nextFieldName, required Name? nextClassName, - TypeDefinitionNode? ofUnion, + Nullable? ofUnion, Name? alias, List? generatedClasses, List? inputsClasses, @@ -127,7 +128,7 @@ class Context { currentType: nextType, currentFieldName: nextFieldName, currentClassName: nextClassName, - ofUnion: ofUnion ?? this.ofUnion, + ofUnion: ofUnion == null ? this.ofUnion : ofUnion.value, generatedClasses: generatedClasses ?? this.generatedClasses, inputsClasses: inputsClasses ?? this.inputsClasses, fragments: fragments ?? this.fragments, @@ -142,7 +143,7 @@ class Context { Name? nextFieldName, Name? nextClassName, Name? alias, - TypeDefinitionNode? ofUnion, + Nullable? ofUnion, List? generatedClasses, List? inputsClasses, List? fragments, @@ -163,7 +164,7 @@ class Context { currentType: nextType, currentFieldName: nextFieldName, currentClassName: nextClassName, - ofUnion: ofUnion ?? this.ofUnion, + ofUnion: ofUnion == null ? this.ofUnion : ofUnion.value, generatedClasses: generatedClasses ?? this.generatedClasses, inputsClasses: inputsClasses ?? this.inputsClasses, fragments: fragments ?? this.fragments, @@ -202,7 +203,7 @@ class Context { Name? nextFieldName, Name? nextClassName, Name? alias, - TypeDefinitionNode? ofUnion, + Nullable? ofUnion, List? generatedClasses, List? inputsClasses, List? fragments, @@ -224,7 +225,7 @@ class Context { currentType: currentType, currentFieldName: nextFieldName ?? currentFieldName, currentClassName: nextClassName ?? currentClassName, - ofUnion: ofUnion ?? this.ofUnion, + ofUnion: ofUnion == null ? this.ofUnion : ofUnion.value, alias: alias ?? this.alias, generatedClasses: generatedClasses ?? this.generatedClasses, inputsClasses: inputsClasses ?? this.inputsClasses, @@ -260,7 +261,7 @@ class Context { /// Returns a copy of this context, with the same type, but on the first path. Context sameTypeWithNoPath({ Name? alias, - TypeDefinitionNode? ofUnion, + Nullable? ofUnion, List? generatedClasses, List? inputsClasses, List? fragments, @@ -273,7 +274,7 @@ class Context { currentType: currentType, currentFieldName: currentFieldName, currentClassName: currentClassName, - ofUnion: ofUnion ?? this.ofUnion, + ofUnion: ofUnion == null ? this.ofUnion : ofUnion.value, alias: alias ?? this.alias, generatedClasses: generatedClasses ?? this.generatedClasses, inputsClasses: inputsClasses ?? this.inputsClasses, @@ -288,7 +289,7 @@ class Context { required TypeDefinitionNode nextType, required Name nextFieldName, required Name nextClassName, - TypeDefinitionNode? ofUnion, + Nullable? ofUnion, Name? alias, List? generatedClasses, List? inputsClasses, @@ -302,7 +303,7 @@ class Context { currentType: nextType, currentFieldName: nextFieldName, currentClassName: nextClassName, - ofUnion: ofUnion ?? this.ofUnion, + ofUnion: ofUnion == null ? this.ofUnion : ofUnion.value, alias: alias ?? this.alias, generatedClasses: generatedClasses ?? this.generatedClasses, inputsClasses: inputsClasses ?? this.inputsClasses, diff --git a/lib/generator/graphql_helpers.dart b/lib/generator/graphql_helpers.dart index cb6dbc5c..c3b8a249 100644 --- a/lib/generator/graphql_helpers.dart +++ b/lib/generator/graphql_helpers.dart @@ -7,12 +7,11 @@ import '../schema/options.dart'; import 'data/definition.dart'; /// Get a full [TypeDefinitionNode] from a type node. -TypeDefinitionNode getTypeByName(DocumentNode schema, TypeNode typeNode, - {String? context}) { +TypeDefinitionNode getTypeByName(DocumentNode schema, TypeNode typeNode) { late NamedTypeNode namedNode; if (typeNode is ListTypeNode) { - return getTypeByName(schema, typeNode.type, context: context); + return getTypeByName(schema, typeNode.type); } if (typeNode is NamedTypeNode) { diff --git a/lib/visitor/canonical_visitor.dart b/lib/visitor/canonical_visitor.dart index b71b4afa..73646ebb 100644 --- a/lib/visitor/canonical_visitor.dart +++ b/lib/visitor/canonical_visitor.dart @@ -1,6 +1,7 @@ import 'package:artemis/generator.dart'; import 'package:artemis/generator/data/data.dart'; import 'package:artemis/generator/data/enum_value_definition.dart'; +import 'package:artemis/generator/data/nullable.dart'; import 'package:artemis/generator/ephemeral_data.dart'; import 'package:artemis/generator/helpers.dart'; import 'package:artemis/generator/graphql_helpers.dart' as gql; @@ -26,7 +27,10 @@ class CanonicalVisitor extends RecursiveVisitor { void visitEnumTypeDefinitionNode(EnumTypeDefinitionNode node) { final enumName = EnumName(name: node.name.value); - final nextContext = context.sameTypeWithNoPath(alias: enumName); + final nextContext = context.sameTypeWithNoPath( + alias: enumName, + ofUnion: Nullable(null), + ); logFn(context, nextContext.align, '-> Enum'); logFn(context, nextContext.align, @@ -47,7 +51,10 @@ class CanonicalVisitor extends RecursiveVisitor { @override void visitInputObjectTypeDefinitionNode(InputObjectTypeDefinitionNode node) { final name = ClassName(name: node.name.value); - final nextContext = context.sameTypeWithNoPath(alias: name); + final nextContext = context.sameTypeWithNoPath( + alias: name, + ofUnion: Nullable(null), + ); logFn(context, nextContext.align, '-> Input class'); logFn(context, nextContext.align, @@ -62,6 +69,7 @@ class CanonicalVisitor extends RecursiveVisitor { nextType: node, nextClassName: ClassName(name: nextType.name.value), nextFieldName: ClassName(name: i.name.value), + ofUnion: Nullable(null), ), markAsUsed: false, ); diff --git a/lib/visitor/generator_visitor.dart b/lib/visitor/generator_visitor.dart index 3ac19eb9..2f82d917 100644 --- a/lib/visitor/generator_visitor.dart +++ b/lib/visitor/generator_visitor.dart @@ -1,5 +1,6 @@ import 'package:artemis/generator.dart'; import 'package:artemis/generator/data/data.dart'; +import 'package:artemis/generator/data/nullable.dart'; import 'package:artemis/generator/ephemeral_data.dart'; import 'package:artemis/generator/graphql_helpers.dart' as gql; import 'package:artemis/generator/helpers.dart'; @@ -93,8 +94,7 @@ class GeneratorVisitor extends RecursiveVisitor { void visitInlineFragmentNode(InlineFragmentNode node) { logFn(context, context.align + 1, '${context.path}: ... on ${node.typeCondition!.on.name.value}'); - final nextType = gql.getTypeByName(context.schema, node.typeCondition!.on, - context: 'inline fragment'); + final nextType = gql.getTypeByName(context.schema, node.typeCondition!.on); if (nextType.name.value == context.currentType!.name.value) { final visitor = GeneratorVisitor( @@ -102,7 +102,7 @@ class GeneratorVisitor extends RecursiveVisitor { nextType: nextType, nextClassName: null, nextFieldName: null, - ofUnion: context.currentType, + ofUnion: Nullable(context.currentType), inputsClasses: [], fragments: [], ), @@ -114,7 +114,7 @@ class GeneratorVisitor extends RecursiveVisitor { nextType: nextType, nextClassName: ClassName(name: nextType.name.value), nextFieldName: ClassPropertyName(name: nextType.name.value), - ofUnion: context.currentType, + ofUnion: Nullable(context.currentType), inputsClasses: [], fragments: [], ), @@ -142,14 +142,14 @@ class GeneratorVisitor extends RecursiveVisitor { @override void visitVariableDefinitionNode(VariableDefinitionNode node) { - final leafType = gql.getTypeByName(context.schema, node.type, - context: 'variable definition'); + final leafType = gql.getTypeByName(context.schema, node.type); final nextClassName = context .nextTypeWithNoPath( nextType: leafType, nextClassName: ClassName(name: leafType.name.value), nextFieldName: ClassName(name: node.variable.name.value), + ofUnion: Nullable(null), ) .fullPathName(); @@ -232,13 +232,17 @@ class GeneratorVisitor extends RecursiveVisitor { '${context.path}: ... expanding ${node.name.value}'); final fragmentName = FragmentName.fromPath( path: context - .sameTypeWithNoPath(alias: FragmentName(name: node.name.value)) + .sameTypeWithNoPath( + alias: FragmentName(name: node.name.value), + ofUnion: Nullable(null), + ) .fullPathName()); final visitor = GeneratorVisitor( context: context.sameTypeWithNextPath( alias: fragmentName, generatedClasses: [], + ofUnion: Nullable(null), log: false, ), ); @@ -254,16 +258,18 @@ class GeneratorVisitor extends RecursiveVisitor { @override void visitFragmentDefinitionNode(FragmentDefinitionNode node) { final partName = FragmentName(name: node.name.value); - final nextContext = context.sameTypeWithNoPath(alias: partName); + final nextContext = context.sameTypeWithNoPath( + alias: partName, + ofUnion: Nullable(null), + ); logFn(context, nextContext.align, '-> Fragment'); logFn(context, nextContext.align, '┌ ${nextContext.path}[${node.name.value}]'); nextContext.fragments.add(node); - final nextType = gql.getTypeByName( - nextContext.schema, node.typeCondition.on, - context: 'fragment definition'); + final nextType = + gql.getTypeByName(nextContext.schema, node.typeCondition.on); final visitorContext = Context( schema: context.schema, diff --git a/pubspec.yaml b/pubspec.yaml index 2babe595..ee2239f8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: artemis -version: 7.0.0-beta.9 +version: 7.0.0-beta.10 description: Build dart types from GraphQL schemas and queries (using Introspection Query). homepage: https://github.com/comigor/artemis diff --git a/test/query_generator/deprecated/deprecated_interface_field_test.dart b/test/query_generator/deprecated/deprecated_interface_field_test.dart index 6e5d9036..88d974d9 100644 --- a/test/query_generator/deprecated/deprecated_interface_field_test.dart +++ b/test/query_generator/deprecated/deprecated_interface_field_test.dart @@ -86,7 +86,6 @@ final LibraryDefinition libraryDefinition = isInput: false), ClassDefinition( name: ClassName(name: r'Custom$_Query$_Node$_ChatMessage$_User'), - extension: ClassName(name: r'Custom$_Query$_Node$_ChatMessage'), mixins: [FragmentName(name: r'UserFragMixin')], factoryPossibilities: {}, typeNameField: ClassPropertyName(name: r'__typename'), @@ -191,7 +190,7 @@ class Custom$Query$Node$User extends Custom$Query$Node } @JsonSerializable(explicitToJson: true) -class Custom$Query$Node$ChatMessage$User extends Custom$Query$Node$ChatMessage +class Custom$Query$Node$ChatMessage$User extends JsonSerializable with EquatableMixin, UserFragMixin { Custom$Query$Node$ChatMessage$User(); diff --git a/test/query_generator/interfaces/interface_fragment_glob_test.dart b/test/query_generator/interfaces/interface_fragment_glob_test.dart index babf495c..86e7e0bf 100644 --- a/test/query_generator/interfaces/interface_fragment_glob_test.dart +++ b/test/query_generator/interfaces/interface_fragment_glob_test.dart @@ -93,7 +93,6 @@ final LibraryDefinition libraryDefinition = ClassDefinition( name: ClassName(name: r'Custom$_Query$_nodeById$_chatMessage$_user'), - extension: ClassName(name: r'Custom$_Query$_nodeById$_chatMessage'), mixins: [FragmentName(name: r'UserFragMixin')], factoryPossibilities: {}, typeNameField: ClassPropertyName(name: r'__typename'), @@ -196,8 +195,7 @@ class Custom$Query$NodeById$User extends Custom$Query$NodeById } @JsonSerializable(explicitToJson: true) -class Custom$Query$NodeById$ChatMessage$User - extends Custom$Query$NodeById$ChatMessage +class Custom$Query$NodeById$ChatMessage$User extends JsonSerializable with EquatableMixin, UserFragMixin { Custom$Query$NodeById$ChatMessage$User(); diff --git a/test/query_generator/interfaces/interface_test.dart b/test/query_generator/interfaces/interface_test.dart index de77db45..945f8a7b 100644 --- a/test/query_generator/interfaces/interface_test.dart +++ b/test/query_generator/interfaces/interface_test.dart @@ -84,7 +84,6 @@ final LibraryDefinition libraryDefinition = isInput: false), ClassDefinition( name: ClassName(name: r'Custom$_Query$_Node$_ChatMessage$_User'), - extension: ClassName(name: r'Custom$_Query$_Node$_ChatMessage'), mixins: [FragmentName(name: r'UserFragMixin')], factoryPossibilities: {}, typeNameField: ClassPropertyName(name: r'__typename'), @@ -187,7 +186,7 @@ class Custom$Query$Node$User extends Custom$Query$Node } @JsonSerializable(explicitToJson: true) -class Custom$Query$Node$ChatMessage$User extends Custom$Query$Node$ChatMessage +class Custom$Query$Node$ChatMessage$User extends JsonSerializable with EquatableMixin, UserFragMixin { Custom$Query$Node$ChatMessage$User(); diff --git a/test/query_generator/union_types_test.dart b/test/query_generator/union/union_types_test.dart similarity index 97% rename from test/query_generator/union_types_test.dart rename to test/query_generator/union/union_types_test.dart index c6687b8a..7eafdcc0 100644 --- a/test/query_generator/union_types_test.dart +++ b/test/query_generator/union/union_types_test.dart @@ -1,20 +1,18 @@ import 'package:artemis/generator/data/data.dart'; import 'package:test/test.dart'; -import '../helpers.dart'; +import '../../helpers.dart'; void main() { - group('On union types', () { - test( - 'On union types', - () async => testGenerator( - query: query, - schema: graphQLSchema, - libraryDefinition: libraryDefinition, - generatedFile: generatedFile, - ), - ); - }); + test( + 'On union types', + () async => testGenerator( + query: query, + schema: graphQLSchema, + libraryDefinition: libraryDefinition, + generatedFile: generatedFile, + ), + ); } final String query = r''' diff --git a/test/query_generator/union/union_with_nested_types_test.dart b/test/query_generator/union/union_with_nested_types_test.dart new file mode 100644 index 00000000..2cce7ebc --- /dev/null +++ b/test/query_generator/union/union_with_nested_types_test.dart @@ -0,0 +1,331 @@ +import 'package:artemis/generator/data/data.dart'; +import 'package:test/test.dart'; + +import '../../helpers.dart'; + +void main() { + test( + 'On union with nested types', + () async => testGenerator( + query: query, + schema: graphQLSchema, + libraryDefinition: libraryDefinition, + generatedFile: generatedFile, + ), + ); +} + +final String query = r''' + query checkoutById($checkoutId: ID!) { + node(id: $checkoutId) { + __typename + ...on Checkout { + id + lineItems { + id + edges { + edges { + id + } + } + } + } + } +} +'''; + +final String graphQLSchema = ''' + schema { + query: QueryRoot + } + + interface Node { + id: ID! + } + + type Checkout implements Node { + id: ID! + lineItems: CheckoutLineItemConnection! + } + + type CheckoutLineItem implements Node { + id: ID! + } + + type CheckoutLineItemConnection { + id: ID! + edges: [CheckoutLineItemEdge!]! + } + + type CheckoutLineItemEdge { + id: ID! + edges: [ImageConnection] + node: CheckoutLineItem! + } + + type Image { + id: ID + } + + type ImageConnection { + id: ID + edges: [ImageEdge!]! + } + + type ImageEdge { + id: ID! + node: Image! + } + + type QueryRoot { + node( + id: ID! + ): Node + } +'''; + +final LibraryDefinition libraryDefinition = + LibraryDefinition(basename: r'query.graphql', queries: [ + QueryDefinition( + name: QueryName(name: r'CheckoutById$_QueryRoot'), + operationName: r'checkoutById', + classes: [ + ClassDefinition( + name: ClassName( + name: + r'CheckoutById$_QueryRoot$_Node$_Checkout$_CheckoutLineItemConnection$_CheckoutLineItemEdge$_ImageConnection'), + properties: [ + ClassProperty( + type: TypeName(name: r'String'), + name: ClassPropertyName(name: r'id'), + isResolveType: false) + ], + factoryPossibilities: {}, + typeNameField: ClassPropertyName(name: r'__typename'), + isInput: false), + ClassDefinition( + name: ClassName( + name: + r'CheckoutById$_QueryRoot$_Node$_Checkout$_CheckoutLineItemConnection$_CheckoutLineItemEdge'), + properties: [ + ClassProperty( + type: ListOfTypeName( + typeName: TypeName( + name: + r'CheckoutById$_QueryRoot$_Node$_Checkout$_CheckoutLineItemConnection$_CheckoutLineItemEdge$_ImageConnection'), + isNonNull: false), + name: ClassPropertyName(name: r'edges'), + isResolveType: false) + ], + factoryPossibilities: {}, + typeNameField: ClassPropertyName(name: r'__typename'), + isInput: false), + ClassDefinition( + name: ClassName( + name: + r'CheckoutById$_QueryRoot$_Node$_Checkout$_CheckoutLineItemConnection'), + properties: [ + ClassProperty( + type: TypeName(name: r'String', isNonNull: true), + name: ClassPropertyName(name: r'id'), + isResolveType: false), + ClassProperty( + type: ListOfTypeName( + typeName: TypeName( + name: + r'CheckoutById$_QueryRoot$_Node$_Checkout$_CheckoutLineItemConnection$_CheckoutLineItemEdge', + isNonNull: true), + isNonNull: true), + name: ClassPropertyName(name: r'edges'), + isResolveType: false) + ], + factoryPossibilities: {}, + typeNameField: ClassPropertyName(name: r'__typename'), + isInput: false), + ClassDefinition( + name: ClassName(name: r'CheckoutById$_QueryRoot$_Node$_Checkout'), + properties: [ + ClassProperty( + type: TypeName(name: r'String', isNonNull: true), + name: ClassPropertyName(name: r'id'), + isResolveType: false), + ClassProperty( + type: TypeName( + name: + r'CheckoutById$_QueryRoot$_Node$_Checkout$_CheckoutLineItemConnection', + isNonNull: true), + name: ClassPropertyName(name: r'lineItems'), + isResolveType: false) + ], + extension: ClassName(name: r'CheckoutById$_QueryRoot$_Node'), + factoryPossibilities: {}, + typeNameField: ClassPropertyName(name: r'__typename'), + isInput: false), + ClassDefinition( + name: ClassName(name: r'CheckoutById$_QueryRoot$_Node'), + properties: [ + ClassProperty( + type: TypeName(name: r'String'), + name: ClassPropertyName(name: r'__typename'), + annotations: [r'''JsonKey(name: '__typename')'''], + isResolveType: true) + ], + factoryPossibilities: { + r'Checkout': + ClassName(name: r'CheckoutById$_QueryRoot$_Node$_Checkout') + }, + typeNameField: ClassPropertyName(name: r'__typename'), + isInput: false), + ClassDefinition( + name: ClassName(name: r'CheckoutById$_QueryRoot'), + properties: [ + ClassProperty( + type: TypeName(name: r'CheckoutById$_QueryRoot$_Node'), + name: ClassPropertyName(name: r'node'), + isResolveType: false) + ], + factoryPossibilities: {}, + typeNameField: ClassPropertyName(name: r'__typename'), + isInput: false) + ], + inputs: [ + QueryInput( + type: TypeName(name: r'String', isNonNull: true), + name: QueryInputName(name: r'checkoutId')) + ], + generateHelpers: false, + suffix: r'Query') +]); + +const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND +// @dart = 2.12 + +import 'package:json_annotation/json_annotation.dart'; +import 'package:equatable/equatable.dart'; +import 'package:gql/ast.dart'; +part 'query.graphql.g.dart'; + +@JsonSerializable(explicitToJson: true) +class CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnection$CheckoutLineItemEdge$ImageConnection + extends JsonSerializable with EquatableMixin { + CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnection$CheckoutLineItemEdge$ImageConnection(); + + factory CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnection$CheckoutLineItemEdge$ImageConnection.fromJson( + Map json) => + _$CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnection$CheckoutLineItemEdge$ImageConnectionFromJson( + json); + + String? id; + + @override + List get props => [id]; + Map toJson() => + _$CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnection$CheckoutLineItemEdge$ImageConnectionToJson( + this); +} + +@JsonSerializable(explicitToJson: true) +class CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnection$CheckoutLineItemEdge + extends JsonSerializable with EquatableMixin { + CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnection$CheckoutLineItemEdge(); + + factory CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnection$CheckoutLineItemEdge.fromJson( + Map json) => + _$CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnection$CheckoutLineItemEdgeFromJson( + json); + + List? + edges; + + @override + List get props => [edges]; + Map toJson() => + _$CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnection$CheckoutLineItemEdgeToJson( + this); +} + +@JsonSerializable(explicitToJson: true) +class CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnection + extends JsonSerializable with EquatableMixin { + CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnection(); + + factory CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnection.fromJson( + Map json) => + _$CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnectionFromJson( + json); + + late String id; + + late List< + CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnection$CheckoutLineItemEdge> + edges; + + @override + List get props => [id, edges]; + Map toJson() => + _$CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnectionToJson( + this); +} + +@JsonSerializable(explicitToJson: true) +class CheckoutById$QueryRoot$Node$Checkout extends CheckoutById$QueryRoot$Node + with EquatableMixin { + CheckoutById$QueryRoot$Node$Checkout(); + + factory CheckoutById$QueryRoot$Node$Checkout.fromJson( + Map json) => + _$CheckoutById$QueryRoot$Node$CheckoutFromJson(json); + + late String id; + + late CheckoutById$QueryRoot$Node$Checkout$CheckoutLineItemConnection + lineItems; + + @override + List get props => [id, lineItems]; + Map toJson() => + _$CheckoutById$QueryRoot$Node$CheckoutToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class CheckoutById$QueryRoot$Node extends JsonSerializable with EquatableMixin { + CheckoutById$QueryRoot$Node(); + + factory CheckoutById$QueryRoot$Node.fromJson(Map json) { + switch (json['__typename'].toString()) { + case r'Checkout': + return CheckoutById$QueryRoot$Node$Checkout.fromJson(json); + default: + } + return _$CheckoutById$QueryRoot$NodeFromJson(json); + } + + @JsonKey(name: '__typename') + String? $$typename; + + @override + List get props => [$$typename]; + Map toJson() { + switch ($$typename) { + case r'Checkout': + return (this as CheckoutById$QueryRoot$Node$Checkout).toJson(); + default: + } + return _$CheckoutById$QueryRoot$NodeToJson(this); + } +} + +@JsonSerializable(explicitToJson: true) +class CheckoutById$QueryRoot extends JsonSerializable with EquatableMixin { + CheckoutById$QueryRoot(); + + factory CheckoutById$QueryRoot.fromJson(Map json) => + _$CheckoutById$QueryRootFromJson(json); + + CheckoutById$QueryRoot$Node? node; + + @override + List get props => [node]; + Map toJson() => _$CheckoutById$QueryRootToJson(this); +} +''';