From 03c8efa168c076539a33b4d8bab3c36d3130c69d Mon Sep 17 00:00:00 2001 From: vasilich Date: Wed, 21 Apr 2021 19:53:17 +0300 Subject: [PATCH] example fixes --- CHANGELOG.md | 7 + example/github/build.yaml | 9 + .../lib/graphql/search_repositories.dart | 188 +---------- .../graphql/search_repositories.graphql.dart | 199 ++++++++++++ ...art => search_repositories.graphql.g.dart} | 25 +- example/github/pubspec.lock | 189 +++++------- example/github/pubspec.yaml | 10 +- example/graphbrainz/build.yaml | 4 +- .../lib/queries/ed_sheeran.query.dart | 276 +---------------- .../lib/queries/ed_sheeran.query.graphql.dart | 291 ++++++++++++++++++ ...g.dart => ed_sheeran.query.graphql.g.dart} | 106 ++++--- example/graphbrainz/pubspec.lock | 198 ++++++------ example/graphbrainz/pubspec.yaml | 10 +- .../graphql/messages_with_users.graphql.dart | 131 ++++---- .../messages_with_users.graphql.g.dart | 21 +- example/hasura/pubspec.lock | 206 ++++++------- example/hasura/pubspec.yaml | 10 +- example/pokemon/build.yaml | 3 + example/pokemon/lib/graphql/big_query.dart | 197 +----------- .../lib/graphql/big_query.graphql.dart | 208 +++++++++++++ ..._query.g.dart => big_query.graphql.g.dart} | 31 +- .../pokemon/lib/graphql/fragment_query.dart | 181 +---------- .../lib/graphql/fragment_query.graphql.dart | 193 ++++++++++++ ...y.g.dart => fragment_query.graphql.g.dart} | 36 ++- .../pokemon/lib/graphql/fragments_glob.dart | 224 +------------- .../lib/graphql/fragments_glob.graphql.dart | 239 ++++++++++++++ ...b.g.dart => fragments_glob.graphql.g.dart} | 19 +- example/pokemon/lib/graphql/simple_query.dart | 85 +---- .../lib/graphql/simple_query.graphql.dart | 92 ++++++ ...ery.g.dart => simple_query.graphql.g.dart} | 8 +- example/pokemon/pubspec.lock | 189 +++++------- example/pokemon/pubspec.yaml | 10 +- lib/visitor/generator_visitor.dart | 6 - pubspec.yaml | 2 +- 34 files changed, 1819 insertions(+), 1784 deletions(-) create mode 100644 example/github/lib/graphql/search_repositories.graphql.dart rename example/github/lib/graphql/{search_repositories.g.dart => search_repositories.graphql.g.dart} (82%) create mode 100644 example/graphbrainz/lib/queries/ed_sheeran.query.graphql.dart rename example/graphbrainz/lib/queries/{ed_sheeran.query.g.dart => ed_sheeran.query.graphql.g.dart} (78%) create mode 100644 example/pokemon/lib/graphql/big_query.graphql.dart rename example/pokemon/lib/graphql/{big_query.g.dart => big_query.graphql.g.dart} (77%) create mode 100644 example/pokemon/lib/graphql/fragment_query.graphql.dart rename example/pokemon/lib/graphql/{fragment_query.g.dart => fragment_query.graphql.g.dart} (76%) create mode 100644 example/pokemon/lib/graphql/fragments_glob.graphql.dart rename example/pokemon/lib/graphql/{fragments_glob.g.dart => fragments_glob.graphql.g.dart} (91%) create mode 100644 example/pokemon/lib/graphql/simple_query.graphql.dart rename example/pokemon/lib/graphql/{simple_query.g.dart => simple_query.graphql.g.dart} (84%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e61c9c2d..f358ebaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## 7.0.0-beta.5 + +- github example fix +- pokemon example fix +- hasura example fix +- graphbrainz example fix + ## 7.0.0-beta.4 - packages update diff --git a/example/github/build.yaml b/example/github/build.yaml index 376f68c9..c40ecced 100644 --- a/example/github/build.yaml +++ b/example/github/build.yaml @@ -6,6 +6,15 @@ targets: builders: artemis: options: + scalar_mapping: + - graphql_type: GitObjectID + dart_type: String + - graphql_type: URI + dart_type: String + - graphql_type: GitRefname + dart_type: String + - graphql_type: DateTime + dart_type: DateTime schema_mapping: - schema: github.schema.graphql queries_glob: lib/graphql/search_repositories.graphql diff --git a/example/github/lib/graphql/search_repositories.dart b/example/github/lib/graphql/search_repositories.dart index 0ea1a9ee..7dd119cf 100644 --- a/example/github/lib/graphql/search_repositories.dart +++ b/example/github/lib/graphql/search_repositories.dart @@ -1,188 +1,2 @@ // GENERATED CODE - DO NOT MODIFY BY HAND - -import 'package:meta/meta.dart'; -import 'package:artemis/artemis.dart'; -import 'package:json_annotation/json_annotation.dart'; -import 'package:equatable/equatable.dart'; -import 'package:gql/ast.dart'; -part 'search_repositories.g.dart'; - -@JsonSerializable(explicitToJson: true) -class SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$Repository - extends SearchRepositories$Query$SearchResultItemConnection$SearchResultItem - with EquatableMixin { - SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$Repository(); - - factory SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$Repository.fromJson( - Map json) => - _$SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$RepositoryFromJson( - json); - - String name; - - @override - List get props => [name]; - Map toJson() => - _$SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$RepositoryToJson( - this); -} - -@JsonSerializable(explicitToJson: true) -class SearchRepositories$Query$SearchResultItemConnection$SearchResultItem - with EquatableMixin { - SearchRepositories$Query$SearchResultItemConnection$SearchResultItem(); - - factory SearchRepositories$Query$SearchResultItemConnection$SearchResultItem.fromJson( - Map json) { - switch (json['__typename'].toString()) { - case r'Repository': - return SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$Repository - .fromJson(json); - default: - } - return _$SearchRepositories$Query$SearchResultItemConnection$SearchResultItemFromJson( - json); - } - - @override - @JsonKey(name: '__typename') - String typeName; - - @override - List get props => [typeName]; - Map toJson() { - switch (typeName) { - case r'Repository': - return (this - as SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$Repository) - .toJson(); - default: - } - return _$SearchRepositories$Query$SearchResultItemConnection$SearchResultItemToJson( - this); - } -} - -@JsonSerializable(explicitToJson: true) -class SearchRepositories$Query$SearchResultItemConnection with EquatableMixin { - SearchRepositories$Query$SearchResultItemConnection(); - - factory SearchRepositories$Query$SearchResultItemConnection.fromJson( - Map json) => - _$SearchRepositories$Query$SearchResultItemConnectionFromJson(json); - - List - nodes; - - @override - List get props => [nodes]; - Map toJson() => - _$SearchRepositories$Query$SearchResultItemConnectionToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class SearchRepositories$Query with EquatableMixin { - SearchRepositories$Query(); - - factory SearchRepositories$Query.fromJson(Map json) => - _$SearchRepositories$QueryFromJson(json); - - SearchRepositories$Query$SearchResultItemConnection search; - - @override - List get props => [search]; - Map toJson() => _$SearchRepositories$QueryToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class SearchRepositoriesArguments extends JsonSerializable with EquatableMixin { - SearchRepositoriesArguments({@required this.query}); - - factory SearchRepositoriesArguments.fromJson(Map json) => - _$SearchRepositoriesArgumentsFromJson(json); - - final String query; - - @override - List get props => [query]; - Map toJson() => _$SearchRepositoriesArgumentsToJson(this); -} - -class SearchRepositoriesQuery extends GraphQLQuery { - SearchRepositoriesQuery({this.variables}); - - @override - final DocumentNode document = DocumentNode(definitions: [ - OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'search_repositories'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'query')), - type: NamedTypeNode( - name: NameNode(value: 'String'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'search'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'first'), - value: IntValueNode(value: '10')), - ArgumentNode( - name: NameNode(value: 'type'), - value: EnumValueNode(name: NameNode(value: 'REPOSITORY'))), - ArgumentNode( - name: NameNode(value: 'query'), - value: VariableNode(name: NameNode(value: 'query'))) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'nodes'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - InlineFragmentNode( - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'Repository'), - isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'name'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) - ])) - ])) - ]); - - @override - final String operationName = 'search_repositories'; - - @override - final SearchRepositoriesArguments variables; - - @override - List get props => [document, operationName, variables]; - @override - SearchRepositories$Query parse(Map json) => - SearchRepositories$Query.fromJson(json); -} +export 'search_repositories.graphql.dart'; diff --git a/example/github/lib/graphql/search_repositories.graphql.dart b/example/github/lib/graphql/search_repositories.graphql.dart new file mode 100644 index 00000000..3aecc329 --- /dev/null +++ b/example/github/lib/graphql/search_repositories.graphql.dart @@ -0,0 +1,199 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// @dart = 2.12 + +import 'package:artemis/artemis.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:equatable/equatable.dart'; +import 'package:gql/ast.dart'; + +part 'search_repositories.graphql.g.dart'; + +@JsonSerializable(explicitToJson: true) +class SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$Repository + extends SearchRepositories$Query$SearchResultItemConnection$SearchResultItem + with EquatableMixin { + SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$Repository(); + + factory SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$Repository.fromJson( + Map json) => + _$SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$RepositoryFromJson( + json); + + late String name; + + @override + List get props => [name]; + + Map toJson() => + _$SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$RepositoryToJson( + this); +} + +@JsonSerializable(explicitToJson: true) +class SearchRepositories$Query$SearchResultItemConnection$SearchResultItem + extends JsonSerializable with EquatableMixin { + SearchRepositories$Query$SearchResultItemConnection$SearchResultItem(); + + factory SearchRepositories$Query$SearchResultItemConnection$SearchResultItem.fromJson( + Map json) { + switch (json['__typename'].toString()) { + case r'Repository': + return SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$Repository + .fromJson(json); + default: + } + return _$SearchRepositories$Query$SearchResultItemConnection$SearchResultItemFromJson( + json); + } + + @JsonKey(name: '__typename') + String? $$typename; + + @override + List get props => [$$typename]; + + Map toJson() { + switch ($$typename) { + case r'Repository': + return (this + as SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$Repository) + .toJson(); + default: + } + return _$SearchRepositories$Query$SearchResultItemConnection$SearchResultItemToJson( + this); + } +} + +@JsonSerializable(explicitToJson: true) +class SearchRepositories$Query$SearchResultItemConnection + extends JsonSerializable with EquatableMixin { + SearchRepositories$Query$SearchResultItemConnection(); + + factory SearchRepositories$Query$SearchResultItemConnection.fromJson( + Map json) => + _$SearchRepositories$Query$SearchResultItemConnectionFromJson(json); + + List? + nodes; + + @override + List get props => [nodes]; + + Map toJson() => + _$SearchRepositories$Query$SearchResultItemConnectionToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class SearchRepositories$Query extends JsonSerializable with EquatableMixin { + SearchRepositories$Query(); + + factory SearchRepositories$Query.fromJson(Map json) => + _$SearchRepositories$QueryFromJson(json); + + late SearchRepositories$Query$SearchResultItemConnection search; + + @override + List get props => [search]; + + Map toJson() => _$SearchRepositories$QueryToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class SearchRepositoriesArguments extends JsonSerializable with EquatableMixin { + SearchRepositoriesArguments({required this.query}); + + @override + factory SearchRepositoriesArguments.fromJson(Map json) => + _$SearchRepositoriesArgumentsFromJson(json); + + late String query; + + @override + List get props => [query]; + + @override + Map toJson() => _$SearchRepositoriesArgumentsToJson(this); +} + +final SEARCH_REPOSITORIES_QUERY_DOCUMENT = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'search_repositories'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'query')), + type: + NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), + defaultValue: DefaultValueNode(value: null), + directives: []) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'search'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'first'), + value: IntValueNode(value: '10')), + ArgumentNode( + name: NameNode(value: 'type'), + value: EnumValueNode(name: NameNode(value: 'REPOSITORY'))), + ArgumentNode( + name: NameNode(value: 'query'), + value: VariableNode(name: NameNode(value: 'query'))) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'nodes'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + InlineFragmentNode( + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'Repository'), + isNonNull: false)), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'name'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])) + ])) + ])) + ])) +]); + +class SearchRepositoriesQuery extends GraphQLQuery { + SearchRepositoriesQuery({required this.variables}); + + @override + final DocumentNode document = SEARCH_REPOSITORIES_QUERY_DOCUMENT; + + @override + final String operationName = 'search_repositories'; + + @override + final SearchRepositoriesArguments variables; + + @override + List get props => [document, operationName, variables]; + + @override + SearchRepositories$Query parse(Map json) => + SearchRepositories$Query.fromJson(json); +} diff --git a/example/github/lib/graphql/search_repositories.g.dart b/example/github/lib/graphql/search_repositories.graphql.g.dart similarity index 82% rename from example/github/lib/graphql/search_repositories.g.dart rename to example/github/lib/graphql/search_repositories.graphql.g.dart index 28d1b8aa..05996e8b 100644 --- a/example/github/lib/graphql/search_repositories.g.dart +++ b/example/github/lib/graphql/search_repositories.graphql.g.dart @@ -1,6 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// @dart=2.12 -part of 'search_repositories.dart'; +part of 'search_repositories.graphql.dart'; // ************************************************************************** // JsonSerializableGenerator @@ -10,7 +11,7 @@ SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$Repository _$SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$RepositoryFromJson( Map json) { return SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$Repository() - ..typeName = json['__typename'] as String + ..$$typename = json['__typename'] as String? ..name = json['name'] as String; } @@ -19,7 +20,7 @@ Map SearchRepositories$Query$SearchResultItemConnection$SearchResultItem$Repository instance) => { - '__typename': instance.typeName, + '__typename': instance.$$typename, 'name': instance.name, }; @@ -27,7 +28,7 @@ SearchRepositories$Query$SearchResultItemConnection$SearchResultItem _$SearchRepositories$Query$SearchResultItemConnection$SearchResultItemFromJson( Map json) { return SearchRepositories$Query$SearchResultItemConnection$SearchResultItem() - ..typeName = json['__typename'] as String; + ..$$typename = json['__typename'] as String?; } Map @@ -35,41 +36,39 @@ Map SearchRepositories$Query$SearchResultItemConnection$SearchResultItem instance) => { - '__typename': instance.typeName, + '__typename': instance.$$typename, }; SearchRepositories$Query$SearchResultItemConnection _$SearchRepositories$Query$SearchResultItemConnectionFromJson( Map json) { return SearchRepositories$Query$SearchResultItemConnection() - ..nodes = (json['nodes'] as List) + ..nodes = (json['nodes'] as List?) ?.map((e) => e == null ? null : SearchRepositories$Query$SearchResultItemConnection$SearchResultItem .fromJson(e as Map)) - ?.toList(); + .toList(); } Map _$SearchRepositories$Query$SearchResultItemConnectionToJson( SearchRepositories$Query$SearchResultItemConnection instance) => { - 'nodes': instance.nodes?.map((e) => e?.toJson())?.toList(), + 'nodes': instance.nodes?.map((e) => e?.toJson()).toList(), }; SearchRepositories$Query _$SearchRepositories$QueryFromJson( Map json) { return SearchRepositories$Query() - ..search = json['search'] == null - ? null - : SearchRepositories$Query$SearchResultItemConnection.fromJson( - json['search'] as Map); + ..search = SearchRepositories$Query$SearchResultItemConnection.fromJson( + json['search'] as Map); } Map _$SearchRepositories$QueryToJson( SearchRepositories$Query instance) => { - 'search': instance.search?.toJson(), + 'search': instance.search.toJson(), }; SearchRepositoriesArguments _$SearchRepositoriesArgumentsFromJson( diff --git a/example/github/pubspec.lock b/example/github/pubspec.lock index bfaa9c18..6345b4d8 100644 --- a/example/github/pubspec.lock +++ b/example/github/pubspec.lock @@ -7,294 +7,301 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "12.0.0" + version: "20.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "0.40.6" + version: "1.4.0" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.5.2" + version: "2.0.0" artemis: dependency: "direct dev" description: path: "../.." relative: true source: path - version: "6.20.1-beta.2" + version: "7.0.0-beta.3" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.1.0" build: dependency: transitive description: name: build url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" + version: "2.0.0" build_config: dependency: transitive description: name: build_config url: "https://pub.dartlang.org" source: hosted - version: "0.4.5" + version: "0.4.7" build_daemon: dependency: transitive description: name: build_daemon url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.10" build_resolvers: dependency: transitive description: name: build_resolvers url: "https://pub.dartlang.org" source: hosted - version: "1.5.3" + version: "2.0.0" build_runner: dependency: "direct dev" description: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "1.11.1" + version: "1.12.2" build_runner_core: dependency: transitive description: name: build_runner_core url: "https://pub.dartlang.org" source: hosted - version: "6.1.7" + version: "6.1.12" built_collection: dependency: transitive description: name: built_collection url: "https://pub.dartlang.org" source: hosted - version: "4.3.0" + version: "5.0.0" built_value: dependency: transitive description: name: built_value url: "https://pub.dartlang.org" source: hosted - version: "7.0.0" + version: "8.0.4" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.0" checked_yaml: dependency: transitive description: name: checked_yaml url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "2.0.1" cli_util: dependency: transitive description: name: cli_util url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.3.0" code_builder: dependency: transitive description: name: code_builder url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "3.7.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.13" + version: "1.15.0" convert: dependency: transitive description: name: convert url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "3.0.0" coverage: dependency: transitive description: name: coverage url: "https://pub.dartlang.org" source: hosted - version: "0.14.2" + version: "1.0.2" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "3.0.1" dart_style: dependency: transitive description: name: dart_style url: "https://pub.dartlang.org" source: hosted - version: "1.3.10" + version: "2.0.0" equatable: dependency: transitive description: name: equatable url: "https://pub.dartlang.org" source: hosted - version: "1.2.5" + version: "2.0.0" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.0" fixnum: dependency: transitive description: name: fixnum url: "https://pub.dartlang.org" source: hosted - version: "0.10.11" + version: "1.0.0" glob: dependency: transitive description: name: glob url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "2.0.1" gql: dependency: transitive description: name: gql url: "https://pub.dartlang.org" source: hosted - version: "0.12.4" - gql_code_gen: + version: "0.13.0-nullsafety.2" + gql_code_builder: dependency: transitive description: - name: gql_code_gen + name: gql_code_builder url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" + version: "0.2.0-nullsafety.0" gql_dedupe_link: dependency: transitive description: name: gql_dedupe_link url: "https://pub.dartlang.org" source: hosted - version: "1.0.10" + version: "2.0.0-nullsafety.1" gql_exec: dependency: transitive description: name: gql_exec url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.3.0-nullsafety.2" gql_http_link: dependency: transitive description: name: gql_http_link url: "https://pub.dartlang.org" source: hosted - version: "0.3.2" + version: "0.4.0-nullsafety.1" gql_link: dependency: transitive description: name: gql_link url: "https://pub.dartlang.org" source: hosted - version: "0.3.1" + version: "0.4.0-nullsafety.3" graphs: dependency: transitive description: name: graphs url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "1.0.0" http: dependency: "direct main" description: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.2" + version: "0.13.1" http_multi_server: dependency: transitive description: name: http_multi_server url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "3.0.0" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.1.4" + version: "4.0.0" io: dependency: transitive description: name: io url: "https://pub.dartlang.org" source: hosted - version: "0.3.3" + version: "1.0.0" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.1+1" + version: "0.6.3" json_annotation: dependency: transitive description: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "3.1.1" + version: "4.0.1" json_serializable: dependency: "direct dev" description: name: json_serializable url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "4.1.0" logging: dependency: transitive description: name: logging url: "https://pub.dartlang.org" source: hosted - version: "0.11.3+2" + version: "1.0.1" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.9" + version: "0.12.10" meta: dependency: transitive description: @@ -308,251 +315,223 @@ packages: name: mime url: "https://pub.dartlang.org" source: hosted - version: "0.9.6+3" - node_interop: - dependency: transitive - description: - name: node_interop - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.3" - node_io: - dependency: transitive - description: - name: node_io - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1+2" + version: "1.0.0" node_preamble: dependency: transitive description: name: node_preamble url: "https://pub.dartlang.org" source: hosted - version: "1.4.8" + version: "2.0.0" package_config: dependency: transitive description: name: package_config url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" - package_resolver: - dependency: transitive - description: - name: package_resolver - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.10" + version: "2.0.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.8.0+1" + version: "1.11.0" pool: dependency: transitive description: name: pool url: "https://pub.dartlang.org" source: hosted - version: "1.4.0" + version: "1.5.0" pub_semver: dependency: transitive description: name: pub_semver url: "https://pub.dartlang.org" source: hosted - version: "1.4.2" + version: "2.0.0" pubspec_parse: dependency: transitive description: name: pubspec_parse url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.2+1" + version: "1.0.0" recase: dependency: transitive description: name: recase url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "4.0.0-nullsafety.0" shelf: dependency: transitive description: name: shelf url: "https://pub.dartlang.org" source: hosted - version: "0.7.5" + version: "1.1.0" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "3.0.0" shelf_static: dependency: transitive description: name: shelf_static url: "https://pub.dartlang.org" source: hosted - version: "0.2.8" + version: "1.0.0" shelf_web_socket: dependency: transitive description: name: shelf_web_socket url: "https://pub.dartlang.org" source: hosted - version: "0.2.3" + version: "1.0.1" source_gen: dependency: transitive description: name: source_gen url: "https://pub.dartlang.org" source: hosted - version: "0.9.10+2" + version: "1.0.0" source_map_stack_trace: dependency: transitive description: name: source_map_stack_trace url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" source_maps: dependency: transitive description: name: source_maps url: "https://pub.dartlang.org" source: hosted - version: "0.10.8" + version: "0.10.10" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" stream_transform: dependency: transitive description: name: stream_transform url: "https://pub.dartlang.org" source: hosted - version: "0.0.20" + version: "2.0.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test: dependency: "direct dev" description: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.15.5" + version: "1.16.8" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.18+1" + version: "0.3.0" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.3.11+2" + version: "0.3.19" timing: dependency: transitive description: name: timing url: "https://pub.dartlang.org" source: hosted - version: "0.1.1+2" + version: "1.0.0" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vm_service: dependency: transitive description: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "6.2.0" watcher: dependency: transitive description: name: watcher url: "https://pub.dartlang.org" source: hosted - version: "0.9.7+12" + version: "1.0.0" web_socket_channel: dependency: transitive description: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "2.0.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol url: "https://pub.dartlang.org" source: hosted - version: "0.7.4" + version: "1.0.0" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.1.0" sdks: - dart: ">=2.12.0-0 <3.0.0" + dart: ">=2.12.0 <3.0.0" diff --git a/example/github/pubspec.yaml b/example/github/pubspec.yaml index aa3e3a03..17367981 100644 --- a/example/github/pubspec.yaml +++ b/example/github/pubspec.yaml @@ -5,14 +5,14 @@ authors: - Igor Borges environment: - sdk: '>=2.0.0 <3.0.0' + sdk: '>=2.12.0 <3.0.0' dependencies: - http: ^0.12.0+2 + http: ^0.13.1 dev_dependencies: - test: ^1.6.3 - build_runner: ^1.5.0 - json_serializable: ^3.0.0 + test: ^1.16.8 + build_runner: ^1.12.2 + json_serializable: ^4.1.0 artemis: path: ../../. diff --git a/example/graphbrainz/build.yaml b/example/graphbrainz/build.yaml index e82cbd80..57c5eed0 100644 --- a/example/graphbrainz/build.yaml +++ b/example/graphbrainz/build.yaml @@ -1,5 +1,7 @@ targets: $default: + sources: + - lib/** builders: artemis: options: @@ -9,7 +11,7 @@ targets: output: lib/queries/ed_sheeran.query.dart custom_parser_import: 'package:graphbrainz_example/coercers.dart' scalar_mapping: - - graphql_type: Date + - graphql_type: Date dart_type: DateTime use_custom_parser: true - graphql_type: Time diff --git a/example/graphbrainz/lib/queries/ed_sheeran.query.dart b/example/graphbrainz/lib/queries/ed_sheeran.query.dart index 2df38dc1..b066cfd2 100644 --- a/example/graphbrainz/lib/queries/ed_sheeran.query.dart +++ b/example/graphbrainz/lib/queries/ed_sheeran.query.dart @@ -1,276 +1,2 @@ // GENERATED CODE - DO NOT MODIFY BY HAND - -import 'package:meta/meta.dart'; -import 'package:artemis/artemis.dart'; -import 'package:json_annotation/json_annotation.dart'; -import 'package:equatable/equatable.dart'; -import 'package:gql/ast.dart'; -part 'ed_sheeran.query.g.dart'; - -@JsonSerializable(explicitToJson: true) -class EdSheeran$Query$Node$Artist$ReleaseConnection$Release - extends EdSheeran$Query$Node$Artist$ReleaseConnection with EquatableMixin { - EdSheeran$Query$Node$Artist$ReleaseConnection$Release(); - - factory EdSheeran$Query$Node$Artist$ReleaseConnection$Release.fromJson( - Map json) => - _$EdSheeran$Query$Node$Artist$ReleaseConnection$ReleaseFromJson(json); - - String id; - - @JsonKey(unknownEnumValue: ReleaseStatus.ARTEMIS_UNKNOWN) - ReleaseStatus status; - - @override - List get props => [id, status]; - Map toJson() => - _$EdSheeran$Query$Node$Artist$ReleaseConnection$ReleaseToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class EdSheeran$Query$Node$Artist$ReleaseConnection - extends EdSheeran$Query$Node$Artist with EquatableMixin { - EdSheeran$Query$Node$Artist$ReleaseConnection(); - - factory EdSheeran$Query$Node$Artist$ReleaseConnection.fromJson( - Map json) => - _$EdSheeran$Query$Node$Artist$ReleaseConnectionFromJson(json); - - List nodes; - - @override - List get props => [nodes]; - Map toJson() => - _$EdSheeran$Query$Node$Artist$ReleaseConnectionToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class EdSheeran$Query$Node$Artist$LifeSpan extends EdSheeran$Query$Node$Artist - with EquatableMixin { - EdSheeran$Query$Node$Artist$LifeSpan(); - - factory EdSheeran$Query$Node$Artist$LifeSpan.fromJson( - Map json) => - _$EdSheeran$Query$Node$Artist$LifeSpanFromJson(json); - - DateTime begin; - - @override - List get props => [begin]; - Map toJson() => - _$EdSheeran$Query$Node$Artist$LifeSpanToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class EdSheeran$Query$Node$Artist$SpotifyArtist - extends EdSheeran$Query$Node$Artist with EquatableMixin { - EdSheeran$Query$Node$Artist$SpotifyArtist(); - - factory EdSheeran$Query$Node$Artist$SpotifyArtist.fromJson( - Map json) => - _$EdSheeran$Query$Node$Artist$SpotifyArtistFromJson(json); - - String href; - - @override - List get props => [href]; - Map toJson() => - _$EdSheeran$Query$Node$Artist$SpotifyArtistToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class EdSheeran$Query$Node$Artist extends EdSheeran$Query$Node - with EquatableMixin { - EdSheeran$Query$Node$Artist(); - - factory EdSheeran$Query$Node$Artist.fromJson(Map json) => - _$EdSheeran$Query$Node$ArtistFromJson(json); - - String mbid; - - String name; - - EdSheeran$Query$Node$Artist$ReleaseConnection releases; - - EdSheeran$Query$Node$Artist$LifeSpan lifeSpan; - - EdSheeran$Query$Node$Artist$SpotifyArtist spotify; - - @override - List get props => [mbid, name, releases, lifeSpan, spotify]; - Map toJson() => _$EdSheeran$Query$Node$ArtistToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class EdSheeran$Query$Node with EquatableMixin { - EdSheeran$Query$Node(); - - factory EdSheeran$Query$Node.fromJson(Map json) { - switch (json['__typename'].toString()) { - case r'Artist': - return EdSheeran$Query$Node$Artist.fromJson(json); - default: - } - return _$EdSheeran$Query$NodeFromJson(json); - } - - String id; - - @override - @JsonKey(name: '__typename') - String typeName; - - @override - List get props => [id, typeName]; - Map toJson() { - switch (typeName) { - case r'Artist': - return (this as EdSheeran$Query$Node$Artist).toJson(); - default: - } - return _$EdSheeran$Query$NodeToJson(this); - } -} - -@JsonSerializable(explicitToJson: true) -class EdSheeran$Query with EquatableMixin { - EdSheeran$Query(); - - factory EdSheeran$Query.fromJson(Map json) => - _$EdSheeran$QueryFromJson(json); - - EdSheeran$Query$Node node; - - @override - List get props => [node]; - Map toJson() => _$EdSheeran$QueryToJson(this); -} - -enum ReleaseStatus { - OFFICIAL, - PROMOTION, - BOOTLEG, - PSEUDORELEASE, - ARTEMIS_UNKNOWN, -} - -class EdSheeranQuery extends GraphQLQuery { - EdSheeranQuery(); - - @override - final DocumentNode document = DocumentNode(definitions: [ - OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'ed_sheeran'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'node'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'id'), - value: StringValueNode( - value: - 'QXJ0aXN0OmI4YTdjNTFmLTM2MmMtNGRjYi1hMjU5LWJjNmUwMDk1ZjBhNg==', - isBlock: false)) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'id'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - InlineFragmentNode( - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'Artist'), isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'mbid'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'name'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'releases'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'nodes'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'id'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'status'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])), - FieldNode( - name: NameNode(value: 'lifeSpan'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'begin'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: 'spotify'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'href'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) - ])) - ])) - ]); - - @override - final String operationName = 'ed_sheeran'; - - @override - List get props => [document, operationName]; - @override - EdSheeran$Query parse(Map json) => - EdSheeran$Query.fromJson(json); -} +export 'ed_sheeran.query.graphql.dart'; diff --git a/example/graphbrainz/lib/queries/ed_sheeran.query.graphql.dart b/example/graphbrainz/lib/queries/ed_sheeran.query.graphql.dart new file mode 100644 index 00000000..71cdecf4 --- /dev/null +++ b/example/graphbrainz/lib/queries/ed_sheeran.query.graphql.dart @@ -0,0 +1,291 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// @dart = 2.12 + +import 'package:artemis/artemis.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:equatable/equatable.dart'; +import 'package:gql/ast.dart'; + +part 'ed_sheeran.query.graphql.g.dart'; + +@JsonSerializable(explicitToJson: true) +class EdSheeran$Query$Node$Artist$ReleaseConnection$Release + extends EdSheeran$Query$Node$Artist$ReleaseConnection with EquatableMixin { + EdSheeran$Query$Node$Artist$ReleaseConnection$Release(); + + factory EdSheeran$Query$Node$Artist$ReleaseConnection$Release.fromJson( + Map json) => + _$EdSheeran$Query$Node$Artist$ReleaseConnection$ReleaseFromJson(json); + + late String id; + + @JsonKey(unknownEnumValue: ReleaseStatus.artemisUnknown) + ReleaseStatus? status; + + @override + List get props => [id, status]; + + Map toJson() => + _$EdSheeran$Query$Node$Artist$ReleaseConnection$ReleaseToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class EdSheeran$Query$Node$Artist$ReleaseConnection + extends EdSheeran$Query$Node$Artist with EquatableMixin { + EdSheeran$Query$Node$Artist$ReleaseConnection(); + + factory EdSheeran$Query$Node$Artist$ReleaseConnection.fromJson( + Map json) => + _$EdSheeran$Query$Node$Artist$ReleaseConnectionFromJson(json); + + List? nodes; + + @override + List get props => [nodes]; + + Map toJson() => + _$EdSheeran$Query$Node$Artist$ReleaseConnectionToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class EdSheeran$Query$Node$Artist$LifeSpan extends EdSheeran$Query$Node$Artist + with EquatableMixin { + EdSheeran$Query$Node$Artist$LifeSpan(); + + factory EdSheeran$Query$Node$Artist$LifeSpan.fromJson( + Map json) => + _$EdSheeran$Query$Node$Artist$LifeSpanFromJson(json); + + DateTime? begin; + + @override + List get props => [begin]; + + Map toJson() => + _$EdSheeran$Query$Node$Artist$LifeSpanToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class EdSheeran$Query$Node$Artist$SpotifyArtist + extends EdSheeran$Query$Node$Artist with EquatableMixin { + EdSheeran$Query$Node$Artist$SpotifyArtist(); + + factory EdSheeran$Query$Node$Artist$SpotifyArtist.fromJson( + Map json) => + _$EdSheeran$Query$Node$Artist$SpotifyArtistFromJson(json); + + late String href; + + @override + List get props => [href]; + + Map toJson() => + _$EdSheeran$Query$Node$Artist$SpotifyArtistToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class EdSheeran$Query$Node$Artist extends EdSheeran$Query$Node + with EquatableMixin { + EdSheeran$Query$Node$Artist(); + + factory EdSheeran$Query$Node$Artist.fromJson(Map json) => + _$EdSheeran$Query$Node$ArtistFromJson(json); + + late String mbid; + + String? name; + + EdSheeran$Query$Node$Artist$ReleaseConnection? releases; + + EdSheeran$Query$Node$Artist$LifeSpan? lifeSpan; + + EdSheeran$Query$Node$Artist$SpotifyArtist? spotify; + + @override + List get props => [mbid, name, releases, lifeSpan, spotify]; + + Map toJson() => _$EdSheeran$Query$Node$ArtistToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class EdSheeran$Query$Node extends JsonSerializable with EquatableMixin { + EdSheeran$Query$Node(); + + factory EdSheeran$Query$Node.fromJson(Map json) { + switch (json['__typename'].toString()) { + case r'Artist': + return EdSheeran$Query$Node$Artist.fromJson(json); + default: + } + return _$EdSheeran$Query$NodeFromJson(json); + } + + @JsonKey(name: '__typename') + String? $$typename; + + late String id; + + @override + List get props => [$$typename, id]; + + Map toJson() { + switch ($$typename) { + case r'Artist': + return (this as EdSheeran$Query$Node$Artist).toJson(); + default: + } + return _$EdSheeran$Query$NodeToJson(this); + } +} + +@JsonSerializable(explicitToJson: true) +class EdSheeran$Query extends JsonSerializable with EquatableMixin { + EdSheeran$Query(); + + factory EdSheeran$Query.fromJson(Map json) => + _$EdSheeran$QueryFromJson(json); + + EdSheeran$Query$Node? node; + + @override + List get props => [node]; + + Map toJson() => _$EdSheeran$QueryToJson(this); +} + +enum ReleaseStatus { + @JsonValue('OFFICIAL') + official, + @JsonValue('PROMOTION') + promotion, + @JsonValue('BOOTLEG') + bootleg, + @JsonValue('PSEUDORELEASE') + pseudorelease, + @JsonValue('ARTEMIS_UNKNOWN') + artemisUnknown, +} + +final ED_SHEERAN_QUERY_DOCUMENT = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'ed_sheeran'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'node'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'id'), + value: StringValueNode( + value: + 'QXJ0aXN0OmI4YTdjNTFmLTM2MmMtNGRjYi1hMjU5LWJjNmUwMDk1ZjBhNg==', + isBlock: false)) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'id'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + InlineFragmentNode( + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'Artist'), isNonNull: false)), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'mbid'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'name'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'releases'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'nodes'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'id'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'status'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])) + ])), + FieldNode( + name: NameNode(value: 'lifeSpan'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'begin'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FieldNode( + name: NameNode(value: 'spotify'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'href'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])) + ])) + ])) + ])) +]); + +class EdSheeranQuery extends GraphQLQuery { + EdSheeranQuery(); + + @override + final DocumentNode document = ED_SHEERAN_QUERY_DOCUMENT; + + @override + final String operationName = 'ed_sheeran'; + + @override + List get props => [document, operationName]; + + @override + EdSheeran$Query parse(Map json) => + EdSheeran$Query.fromJson(json); +} diff --git a/example/graphbrainz/lib/queries/ed_sheeran.query.g.dart b/example/graphbrainz/lib/queries/ed_sheeran.query.graphql.g.dart similarity index 78% rename from example/graphbrainz/lib/queries/ed_sheeran.query.g.dart rename to example/graphbrainz/lib/queries/ed_sheeran.query.graphql.g.dart index 0c5e9d70..85e45beb 100644 --- a/example/graphbrainz/lib/queries/ed_sheeran.query.g.dart +++ b/example/graphbrainz/lib/queries/ed_sheeran.query.graphql.g.dart @@ -1,6 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// @dart=2.12 -part of 'ed_sheeran.query.dart'; +part of 'ed_sheeran.query.graphql.dart'; // ************************************************************************** // JsonSerializableGenerator @@ -10,9 +11,9 @@ EdSheeran$Query$Node$Artist$ReleaseConnection$Release _$EdSheeran$Query$Node$Artist$ReleaseConnection$ReleaseFromJson( Map json) { return EdSheeran$Query$Node$Artist$ReleaseConnection$Release() - ..typeName = json['__typename'] as String + ..$$typename = json['__typename'] as String? ..mbid = json['mbid'] as String - ..name = json['name'] as String + ..name = json['name'] as String? ..releases = json['releases'] == null ? null : EdSheeran$Query$Node$Artist$ReleaseConnection.fromJson( @@ -25,80 +26,85 @@ EdSheeran$Query$Node$Artist$ReleaseConnection$Release ? null : EdSheeran$Query$Node$Artist$SpotifyArtist.fromJson( json['spotify'] as Map) - ..nodes = (json['nodes'] as List) + ..nodes = (json['nodes'] as List?) ?.map((e) => e == null ? null : EdSheeran$Query$Node$Artist$ReleaseConnection$Release.fromJson( e as Map)) - ?.toList() + .toList() ..id = json['id'] as String ..status = _$enumDecodeNullable(_$ReleaseStatusEnumMap, json['status'], - unknownValue: ReleaseStatus.ARTEMIS_UNKNOWN); + unknownValue: ReleaseStatus.artemisUnknown); } Map _$EdSheeran$Query$Node$Artist$ReleaseConnection$ReleaseToJson( EdSheeran$Query$Node$Artist$ReleaseConnection$Release instance) => { - '__typename': instance.typeName, + '__typename': instance.$$typename, 'mbid': instance.mbid, 'name': instance.name, 'releases': instance.releases?.toJson(), 'lifeSpan': instance.lifeSpan?.toJson(), 'spotify': instance.spotify?.toJson(), - 'nodes': instance.nodes?.map((e) => e?.toJson())?.toList(), + 'nodes': instance.nodes?.map((e) => e?.toJson()).toList(), 'id': instance.id, 'status': _$ReleaseStatusEnumMap[instance.status], }; -T _$enumDecode( - Map enumValues, - dynamic source, { - T unknownValue, +K _$enumDecode( + Map enumValues, + Object? source, { + K? unknownValue, }) { if (source == null) { - throw ArgumentError('A value must be provided. Supported values: ' - '${enumValues.values.join(', ')}'); + throw ArgumentError( + 'A value must be provided. Supported values: ' + '${enumValues.values.join(', ')}', + ); } - final value = enumValues.entries - .singleWhere((e) => e.value == source, orElse: () => null) - ?.key; - - if (value == null && unknownValue == null) { - throw ArgumentError('`$source` is not one of the supported values: ' - '${enumValues.values.join(', ')}'); - } - return value ?? unknownValue; + return enumValues.entries.singleWhere( + (e) => e.value == source, + orElse: () { + if (unknownValue == null) { + throw ArgumentError( + '`$source` is not one of the supported values: ' + '${enumValues.values.join(', ')}', + ); + } + return MapEntry(unknownValue, enumValues.values.first); + }, + ).key; } -T _$enumDecodeNullable( - Map enumValues, +K? _$enumDecodeNullable( + Map enumValues, dynamic source, { - T unknownValue, + K? unknownValue, }) { if (source == null) { return null; } - return _$enumDecode(enumValues, source, unknownValue: unknownValue); + return _$enumDecode(enumValues, source, unknownValue: unknownValue); } const _$ReleaseStatusEnumMap = { - ReleaseStatus.OFFICIAL: 'OFFICIAL', - ReleaseStatus.PROMOTION: 'PROMOTION', - ReleaseStatus.BOOTLEG: 'BOOTLEG', - ReleaseStatus.PSEUDORELEASE: 'PSEUDORELEASE', - ReleaseStatus.ARTEMIS_UNKNOWN: 'ARTEMIS_UNKNOWN', + ReleaseStatus.official: 'OFFICIAL', + ReleaseStatus.promotion: 'PROMOTION', + ReleaseStatus.bootleg: 'BOOTLEG', + ReleaseStatus.pseudorelease: 'PSEUDORELEASE', + ReleaseStatus.artemisUnknown: 'ARTEMIS_UNKNOWN', }; EdSheeran$Query$Node$Artist$ReleaseConnection _$EdSheeran$Query$Node$Artist$ReleaseConnectionFromJson( Map json) { return EdSheeran$Query$Node$Artist$ReleaseConnection() + ..$$typename = json['__typename'] as String? ..id = json['id'] as String - ..typeName = json['__typename'] as String ..mbid = json['mbid'] as String - ..name = json['name'] as String + ..name = json['name'] as String? ..releases = json['releases'] == null ? null : EdSheeran$Query$Node$Artist$ReleaseConnection.fromJson( @@ -111,34 +117,34 @@ EdSheeran$Query$Node$Artist$ReleaseConnection ? null : EdSheeran$Query$Node$Artist$SpotifyArtist.fromJson( json['spotify'] as Map) - ..nodes = (json['nodes'] as List) + ..nodes = (json['nodes'] as List?) ?.map((e) => e == null ? null : EdSheeran$Query$Node$Artist$ReleaseConnection$Release.fromJson( e as Map)) - ?.toList(); + .toList(); } Map _$EdSheeran$Query$Node$Artist$ReleaseConnectionToJson( EdSheeran$Query$Node$Artist$ReleaseConnection instance) => { + '__typename': instance.$$typename, 'id': instance.id, - '__typename': instance.typeName, 'mbid': instance.mbid, 'name': instance.name, 'releases': instance.releases?.toJson(), 'lifeSpan': instance.lifeSpan?.toJson(), 'spotify': instance.spotify?.toJson(), - 'nodes': instance.nodes?.map((e) => e?.toJson())?.toList(), + 'nodes': instance.nodes?.map((e) => e?.toJson()).toList(), }; EdSheeran$Query$Node$Artist$LifeSpan _$EdSheeran$Query$Node$Artist$LifeSpanFromJson(Map json) { return EdSheeran$Query$Node$Artist$LifeSpan() + ..$$typename = json['__typename'] as String? ..id = json['id'] as String - ..typeName = json['__typename'] as String ..mbid = json['mbid'] as String - ..name = json['name'] as String + ..name = json['name'] as String? ..releases = json['releases'] == null ? null : EdSheeran$Query$Node$Artist$ReleaseConnection.fromJson( @@ -158,8 +164,8 @@ EdSheeran$Query$Node$Artist$LifeSpan Map _$EdSheeran$Query$Node$Artist$LifeSpanToJson( EdSheeran$Query$Node$Artist$LifeSpan instance) => { + '__typename': instance.$$typename, 'id': instance.id, - '__typename': instance.typeName, 'mbid': instance.mbid, 'name': instance.name, 'releases': instance.releases?.toJson(), @@ -172,10 +178,10 @@ EdSheeran$Query$Node$Artist$SpotifyArtist _$EdSheeran$Query$Node$Artist$SpotifyArtistFromJson( Map json) { return EdSheeran$Query$Node$Artist$SpotifyArtist() + ..$$typename = json['__typename'] as String? ..id = json['id'] as String - ..typeName = json['__typename'] as String ..mbid = json['mbid'] as String - ..name = json['name'] as String + ..name = json['name'] as String? ..releases = json['releases'] == null ? null : EdSheeran$Query$Node$Artist$ReleaseConnection.fromJson( @@ -194,8 +200,8 @@ EdSheeran$Query$Node$Artist$SpotifyArtist Map _$EdSheeran$Query$Node$Artist$SpotifyArtistToJson( EdSheeran$Query$Node$Artist$SpotifyArtist instance) => { + '__typename': instance.$$typename, 'id': instance.id, - '__typename': instance.typeName, 'mbid': instance.mbid, 'name': instance.name, 'releases': instance.releases?.toJson(), @@ -207,10 +213,10 @@ Map _$EdSheeran$Query$Node$Artist$SpotifyArtistToJson( EdSheeran$Query$Node$Artist _$EdSheeran$Query$Node$ArtistFromJson( Map json) { return EdSheeran$Query$Node$Artist() + ..$$typename = json['__typename'] as String? ..id = json['id'] as String - ..typeName = json['__typename'] as String ..mbid = json['mbid'] as String - ..name = json['name'] as String + ..name = json['name'] as String? ..releases = json['releases'] == null ? null : EdSheeran$Query$Node$Artist$ReleaseConnection.fromJson( @@ -228,8 +234,8 @@ EdSheeran$Query$Node$Artist _$EdSheeran$Query$Node$ArtistFromJson( Map _$EdSheeran$Query$Node$ArtistToJson( EdSheeran$Query$Node$Artist instance) => { + '__typename': instance.$$typename, 'id': instance.id, - '__typename': instance.typeName, 'mbid': instance.mbid, 'name': instance.name, 'releases': instance.releases?.toJson(), @@ -239,15 +245,15 @@ Map _$EdSheeran$Query$Node$ArtistToJson( EdSheeran$Query$Node _$EdSheeran$Query$NodeFromJson(Map json) { return EdSheeran$Query$Node() - ..id = json['id'] as String - ..typeName = json['__typename'] as String; + ..$$typename = json['__typename'] as String? + ..id = json['id'] as String; } Map _$EdSheeran$Query$NodeToJson( EdSheeran$Query$Node instance) => { + '__typename': instance.$$typename, 'id': instance.id, - '__typename': instance.typeName, }; EdSheeran$Query _$EdSheeran$QueryFromJson(Map json) { diff --git a/example/graphbrainz/pubspec.lock b/example/graphbrainz/pubspec.lock index 46c85a87..ed96ec66 100644 --- a/example/graphbrainz/pubspec.lock +++ b/example/graphbrainz/pubspec.lock @@ -7,301 +7,315 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "12.0.0" + version: "20.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "0.40.6" + version: "1.4.0" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.5.2" + version: "2.0.0" artemis: dependency: "direct dev" description: path: "../.." relative: true source: path - version: "6.20.1-beta.2" + version: "7.0.0-beta.3" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.1.0" build: dependency: transitive description: name: build url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" + version: "2.0.0" build_config: dependency: transitive description: name: build_config url: "https://pub.dartlang.org" source: hosted - version: "0.4.5" + version: "0.4.7" build_daemon: dependency: transitive description: name: build_daemon url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.10" build_resolvers: dependency: transitive description: name: build_resolvers url: "https://pub.dartlang.org" source: hosted - version: "1.5.3" + version: "2.0.0" build_runner: dependency: "direct dev" description: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "1.11.1" + version: "1.12.2" build_runner_core: dependency: transitive description: name: build_runner_core url: "https://pub.dartlang.org" source: hosted - version: "6.1.7" + version: "6.1.12" built_collection: dependency: transitive description: name: built_collection url: "https://pub.dartlang.org" source: hosted - version: "4.3.0" + version: "5.0.0" built_value: dependency: transitive description: name: built_value url: "https://pub.dartlang.org" source: hosted - version: "7.0.0" + version: "8.0.4" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.0" checked_yaml: dependency: transitive description: name: checked_yaml url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "2.0.1" cli_util: dependency: transitive description: name: cli_util url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.3.0" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" code_builder: dependency: transitive description: name: code_builder url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "3.7.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.13" + version: "1.15.0" convert: dependency: transitive description: name: convert url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "3.0.0" coverage: dependency: transitive description: name: coverage url: "https://pub.dartlang.org" source: hosted - version: "0.14.2" + version: "1.0.2" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "3.0.1" dart_style: dependency: transitive description: name: dart_style url: "https://pub.dartlang.org" source: hosted - version: "1.3.10" + version: "2.0.0" equatable: dependency: transitive description: name: equatable url: "https://pub.dartlang.org" source: hosted - version: "1.2.5" + version: "2.0.0" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.0" fixnum: dependency: transitive description: name: fixnum url: "https://pub.dartlang.org" source: hosted - version: "0.10.11" + version: "1.0.0" glob: dependency: transitive description: name: glob url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "2.0.1" gql: dependency: transitive description: name: gql url: "https://pub.dartlang.org" source: hosted - version: "0.12.4" - gql_code_gen: + version: "0.13.0-nullsafety.2" + gql_code_builder: dependency: transitive description: - name: gql_code_gen + name: gql_code_builder url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" + version: "0.2.0-nullsafety.0" gql_dedupe_link: dependency: transitive description: name: gql_dedupe_link url: "https://pub.dartlang.org" source: hosted - version: "1.0.10" + version: "2.0.0-nullsafety.1" gql_exec: dependency: transitive description: name: gql_exec url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.3.0-nullsafety.2" gql_http_link: dependency: transitive description: name: gql_http_link url: "https://pub.dartlang.org" source: hosted - version: "0.3.2" + version: "0.4.0-nullsafety.1" gql_link: dependency: transitive description: name: gql_link url: "https://pub.dartlang.org" source: hosted - version: "0.3.1" + version: "0.4.0-nullsafety.3" graphs: dependency: transitive description: name: graphs url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "1.0.0" http: dependency: "direct main" description: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.2" + version: "0.13.1" http_multi_server: dependency: transitive description: name: http_multi_server url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "3.0.0" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.1.4" + version: "4.0.0" intl: dependency: "direct main" description: name: intl url: "https://pub.dartlang.org" source: hosted - version: "0.15.8" + version: "0.17.0" io: dependency: transitive description: name: io url: "https://pub.dartlang.org" source: hosted - version: "0.3.3" + version: "1.0.0" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.1+1" + version: "0.6.3" json_annotation: dependency: transitive description: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "3.1.1" + version: "4.0.1" json_serializable: dependency: "direct dev" description: name: json_serializable url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "4.1.0" logging: dependency: transitive description: name: logging url: "https://pub.dartlang.org" source: hosted - version: "0.11.3+2" + version: "1.0.1" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.9" + version: "0.12.10" meta: dependency: transitive description: @@ -315,251 +329,223 @@ packages: name: mime url: "https://pub.dartlang.org" source: hosted - version: "0.9.6+3" - node_interop: - dependency: transitive - description: - name: node_interop - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.3" - node_io: - dependency: transitive - description: - name: node_io - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1+2" + version: "1.0.0" node_preamble: dependency: transitive description: name: node_preamble url: "https://pub.dartlang.org" source: hosted - version: "1.4.8" + version: "2.0.0" package_config: dependency: transitive description: name: package_config url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" - package_resolver: - dependency: transitive - description: - name: package_resolver - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.10" + version: "2.0.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.8.0+1" + version: "1.11.0" pool: dependency: transitive description: name: pool url: "https://pub.dartlang.org" source: hosted - version: "1.4.0" + version: "1.5.0" pub_semver: dependency: transitive description: name: pub_semver url: "https://pub.dartlang.org" source: hosted - version: "1.4.2" + version: "2.0.0" pubspec_parse: dependency: transitive description: name: pubspec_parse url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.2+1" + version: "1.0.0" recase: dependency: transitive description: name: recase url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "4.0.0-nullsafety.0" shelf: dependency: transitive description: name: shelf url: "https://pub.dartlang.org" source: hosted - version: "0.7.5" + version: "1.1.0" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "3.0.0" shelf_static: dependency: transitive description: name: shelf_static url: "https://pub.dartlang.org" source: hosted - version: "0.2.8" + version: "1.0.0" shelf_web_socket: dependency: transitive description: name: shelf_web_socket url: "https://pub.dartlang.org" source: hosted - version: "0.2.3" + version: "1.0.1" source_gen: dependency: transitive description: name: source_gen url: "https://pub.dartlang.org" source: hosted - version: "0.9.10+2" + version: "1.0.0" source_map_stack_trace: dependency: transitive description: name: source_map_stack_trace url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" source_maps: dependency: transitive description: name: source_maps url: "https://pub.dartlang.org" source: hosted - version: "0.10.8" + version: "0.10.10" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" stream_transform: dependency: transitive description: name: stream_transform url: "https://pub.dartlang.org" source: hosted - version: "0.0.20" + version: "2.0.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test: dependency: "direct dev" description: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.15.5" + version: "1.16.8" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.18+1" + version: "0.3.0" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.3.11+2" + version: "0.3.19" timing: dependency: transitive description: name: timing url: "https://pub.dartlang.org" source: hosted - version: "0.1.1+2" + version: "1.0.0" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vm_service: dependency: transitive description: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "6.2.0" watcher: dependency: transitive description: name: watcher url: "https://pub.dartlang.org" source: hosted - version: "0.9.7+12" + version: "1.0.0" web_socket_channel: dependency: transitive description: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "2.0.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol url: "https://pub.dartlang.org" source: hosted - version: "0.7.4" + version: "1.0.0" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.1.0" sdks: - dart: ">=2.12.0-0 <3.0.0" + dart: ">=2.12.0 <3.0.0" diff --git a/example/graphbrainz/pubspec.yaml b/example/graphbrainz/pubspec.yaml index f2ce6dc0..9f31e218 100644 --- a/example/graphbrainz/pubspec.yaml +++ b/example/graphbrainz/pubspec.yaml @@ -8,12 +8,12 @@ environment: sdk: '>=2.0.0 <3.0.0' dependencies: - http: ^0.12.0+2 - intl: ^0.15.8 + http: ^0.13.1 + intl: ^0.17.0 dev_dependencies: - test: ^1.6.3 - build_runner: ^1.5.0 - json_serializable: ^3.0.0 + test: ^1.16.8 + build_runner: ^1.12.2 + json_serializable: ^4.1.0 artemis: path: ../../. diff --git a/example/hasura/lib/graphql/messages_with_users.graphql.dart b/example/hasura/lib/graphql/messages_with_users.graphql.dart index a2386d88..875d7f99 100644 --- a/example/hasura/lib/graphql/messages_with_users.graphql.dart +++ b/example/hasura/lib/graphql/messages_with_users.graphql.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// @dart = 2.12 -import 'package:meta/meta.dart'; import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -8,117 +8,126 @@ import 'package:gql/ast.dart'; part 'messages_with_users.graphql.g.dart'; @JsonSerializable(explicitToJson: true) -class MessagesWithUsers$SubscriptionRoot$Messages$Profile with EquatableMixin { +class MessagesWithUsers$SubscriptionRoot$Messages$Profile + extends JsonSerializable with EquatableMixin { MessagesWithUsers$SubscriptionRoot$Messages$Profile(); factory MessagesWithUsers$SubscriptionRoot$Messages$Profile.fromJson( Map json) => _$MessagesWithUsers$SubscriptionRoot$Messages$ProfileFromJson(json); - int id; + late int id; - String name; + late String name; @override - List get props => [id, name]; + List get props => [id, name]; + Map toJson() => _$MessagesWithUsers$SubscriptionRoot$Messages$ProfileToJson(this); } @JsonSerializable(explicitToJson: true) -class MessagesWithUsers$SubscriptionRoot$Messages with EquatableMixin { +class MessagesWithUsers$SubscriptionRoot$Messages extends JsonSerializable + with EquatableMixin { MessagesWithUsers$SubscriptionRoot$Messages(); factory MessagesWithUsers$SubscriptionRoot$Messages.fromJson( Map json) => _$MessagesWithUsers$SubscriptionRoot$MessagesFromJson(json); - int id; + late int id; - String message; + late String message; - MessagesWithUsers$SubscriptionRoot$Messages$Profile profile; + late MessagesWithUsers$SubscriptionRoot$Messages$Profile profile; @override - List get props => [id, message, profile]; + List get props => [id, message, profile]; + Map toJson() => _$MessagesWithUsers$SubscriptionRoot$MessagesToJson(this); } @JsonSerializable(explicitToJson: true) -class MessagesWithUsers$SubscriptionRoot with EquatableMixin { +class MessagesWithUsers$SubscriptionRoot extends JsonSerializable + with EquatableMixin { MessagesWithUsers$SubscriptionRoot(); factory MessagesWithUsers$SubscriptionRoot.fromJson( Map json) => _$MessagesWithUsers$SubscriptionRootFromJson(json); - List messages; + late List messages; @override - List get props => [messages]; + List get props => [messages]; + Map toJson() => _$MessagesWithUsers$SubscriptionRootToJson(this); } +final MESSAGES_WITH_USERS_SUBSCRIPTION_DOCUMENT = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.subscription, + name: NameNode(value: 'messages_with_users'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'messages'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'id'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'message'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'profile'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'id'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'name'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])) + ])) + ])) +]); + class MessagesWithUsersSubscription extends GraphQLQuery { MessagesWithUsersSubscription(); @override - final DocumentNode document = DocumentNode(definitions: [ - OperationDefinitionNode( - type: OperationType.subscription, - name: NameNode(value: 'messages_with_users'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'messages'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'id'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'message'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'profile'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'id'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'name'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) - ])) - ]); + final DocumentNode document = MESSAGES_WITH_USERS_SUBSCRIPTION_DOCUMENT; @override final String operationName = 'messages_with_users'; @override - List get props => [document, operationName]; + List get props => [document, operationName]; + @override MessagesWithUsers$SubscriptionRoot parse(Map json) => MessagesWithUsers$SubscriptionRoot.fromJson(json); diff --git a/example/hasura/lib/graphql/messages_with_users.graphql.g.dart b/example/hasura/lib/graphql/messages_with_users.graphql.g.dart index c1c2cba3..ab5d5d08 100644 --- a/example/hasura/lib/graphql/messages_with_users.graphql.g.dart +++ b/example/hasura/lib/graphql/messages_with_users.graphql.g.dart @@ -1,4 +1,5 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// @dart=2.12 part of 'messages_with_users.graphql.dart'; @@ -28,10 +29,8 @@ MessagesWithUsers$SubscriptionRoot$Messages return MessagesWithUsers$SubscriptionRoot$Messages() ..id = json['id'] as int ..message = json['message'] as String - ..profile = json['profile'] == null - ? null - : MessagesWithUsers$SubscriptionRoot$Messages$Profile.fromJson( - json['profile'] as Map); + ..profile = MessagesWithUsers$SubscriptionRoot$Messages$Profile.fromJson( + json['profile'] as Map); } Map _$MessagesWithUsers$SubscriptionRoot$MessagesToJson( @@ -39,22 +38,20 @@ Map _$MessagesWithUsers$SubscriptionRoot$MessagesToJson( { 'id': instance.id, 'message': instance.message, - 'profile': instance.profile?.toJson(), + 'profile': instance.profile.toJson(), }; MessagesWithUsers$SubscriptionRoot _$MessagesWithUsers$SubscriptionRootFromJson( Map json) { return MessagesWithUsers$SubscriptionRoot() - ..messages = (json['messages'] as List) - ?.map((e) => e == null - ? null - : MessagesWithUsers$SubscriptionRoot$Messages.fromJson( - e as Map)) - ?.toList(); + ..messages = (json['messages'] as List) + .map((e) => MessagesWithUsers$SubscriptionRoot$Messages.fromJson( + e as Map)) + .toList(); } Map _$MessagesWithUsers$SubscriptionRootToJson( MessagesWithUsers$SubscriptionRoot instance) => { - 'messages': instance.messages?.map((e) => e?.toJson())?.toList(), + 'messages': instance.messages.map((e) => e.toJson()).toList(), }; diff --git a/example/hasura/pubspec.lock b/example/hasura/pubspec.lock index 31dd3326..2175c60f 100644 --- a/example/hasura/pubspec.lock +++ b/example/hasura/pubspec.lock @@ -7,301 +7,308 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "12.0.0" + version: "20.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "0.40.6" + version: "1.4.0" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.5.2" + version: "2.0.0" artemis: dependency: "direct dev" description: path: "../.." relative: true source: path - version: "6.20.1-beta.2" + version: "7.0.0-beta.3.1" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.1.0" build: dependency: transitive description: name: build url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" + version: "2.0.0" build_config: dependency: transitive description: name: build_config url: "https://pub.dartlang.org" source: hosted - version: "0.4.5" + version: "0.4.7" build_daemon: dependency: transitive description: name: build_daemon url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.10" build_resolvers: dependency: transitive description: name: build_resolvers url: "https://pub.dartlang.org" source: hosted - version: "1.5.3" + version: "2.0.0" build_runner: dependency: "direct dev" description: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "1.11.1" + version: "1.12.2" build_runner_core: dependency: transitive description: name: build_runner_core url: "https://pub.dartlang.org" source: hosted - version: "6.1.7" + version: "6.1.12" built_collection: dependency: transitive description: name: built_collection url: "https://pub.dartlang.org" source: hosted - version: "4.3.0" + version: "5.0.0" built_value: dependency: transitive description: name: built_value url: "https://pub.dartlang.org" source: hosted - version: "7.0.0" + version: "8.0.4" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.0" checked_yaml: dependency: transitive description: name: checked_yaml url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "2.0.1" cli_util: dependency: transitive description: name: cli_util url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.3.0" code_builder: dependency: transitive description: name: code_builder url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "3.7.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.13" + version: "1.15.0" convert: dependency: transitive description: name: convert url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "3.0.0" coverage: dependency: transitive description: name: coverage url: "https://pub.dartlang.org" source: hosted - version: "0.14.2" + version: "1.0.2" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "3.0.1" dart_style: dependency: transitive description: name: dart_style url: "https://pub.dartlang.org" source: hosted - version: "1.3.10" + version: "2.0.0" equatable: dependency: transitive description: name: equatable url: "https://pub.dartlang.org" source: hosted - version: "1.2.5" + version: "2.0.0" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.0" fixnum: dependency: transitive description: name: fixnum url: "https://pub.dartlang.org" source: hosted - version: "0.10.11" + version: "1.0.0" glob: dependency: transitive description: name: glob url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "2.0.1" gql: dependency: transitive description: name: gql url: "https://pub.dartlang.org" source: hosted - version: "0.12.4" - gql_code_gen: + version: "0.13.0-nullsafety.2" + gql_code_builder: dependency: transitive description: - name: gql_code_gen + name: gql_code_builder url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" + version: "0.2.0-nullsafety.0" gql_dedupe_link: dependency: transitive description: name: gql_dedupe_link url: "https://pub.dartlang.org" source: hosted - version: "1.0.10" + version: "2.0.0-nullsafety.1" gql_exec: dependency: transitive description: name: gql_exec url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.3.0-nullsafety.2" gql_http_link: dependency: transitive description: name: gql_http_link url: "https://pub.dartlang.org" source: hosted - version: "0.3.2" + version: "0.4.0-nullsafety.1" gql_link: dependency: transitive description: name: gql_link url: "https://pub.dartlang.org" source: hosted - version: "0.3.1" + version: "0.4.0-nullsafety.3" gql_websocket_link: dependency: "direct main" description: name: gql_websocket_link url: "https://pub.dartlang.org" source: hosted - version: "0.1.1-alpha+1588872921551" + version: "0.3.0-nullsafety.1" graphs: dependency: transitive description: name: graphs url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "1.0.0" http: dependency: "direct main" description: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.2" + version: "0.13.1" http_multi_server: dependency: transitive description: name: http_multi_server url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "3.0.0" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.1.4" + version: "4.0.0" io: dependency: transitive description: name: io url: "https://pub.dartlang.org" source: hosted - version: "0.3.3" + version: "1.0.0" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.1+1" + version: "0.6.3" json_annotation: dependency: transitive description: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "3.1.1" + version: "4.0.1" json_serializable: dependency: "direct dev" description: name: json_serializable url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "4.1.0" logging: dependency: transitive description: name: logging url: "https://pub.dartlang.org" source: hosted - version: "0.11.3+2" + version: "1.0.1" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.9" + version: "0.12.10" meta: dependency: transitive description: @@ -315,272 +322,237 @@ packages: name: mime url: "https://pub.dartlang.org" source: hosted - version: "0.9.6+3" - node_interop: - dependency: transitive - description: - name: node_interop - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.3" - node_io: - dependency: transitive - description: - name: node_io - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1+2" + version: "1.0.0" node_preamble: dependency: transitive description: name: node_preamble url: "https://pub.dartlang.org" source: hosted - version: "1.4.8" + version: "2.0.0" package_config: dependency: transitive description: name: package_config url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" - package_resolver: - dependency: transitive - description: - name: package_resolver - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.10" + version: "2.0.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.8.0+1" + version: "1.11.0" pool: dependency: transitive description: name: pool url: "https://pub.dartlang.org" source: hosted - version: "1.4.0" + version: "1.5.0" pub_semver: dependency: transitive description: name: pub_semver url: "https://pub.dartlang.org" source: hosted - version: "1.4.2" + version: "2.0.0" pubspec_parse: dependency: transitive description: name: pubspec_parse url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.2+1" + version: "1.0.0" recase: dependency: transitive description: name: recase url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "4.0.0-nullsafety.0" rxdart: dependency: transitive description: name: rxdart url: "https://pub.dartlang.org" source: hosted - version: "0.24.0" + version: "0.26.0" shelf: dependency: transitive description: name: shelf url: "https://pub.dartlang.org" source: hosted - version: "0.7.5" + version: "1.1.0" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "3.0.0" shelf_static: dependency: transitive description: name: shelf_static url: "https://pub.dartlang.org" source: hosted - version: "0.2.8" + version: "1.0.0" shelf_web_socket: dependency: transitive description: name: shelf_web_socket url: "https://pub.dartlang.org" source: hosted - version: "0.2.3" + version: "1.0.1" source_gen: dependency: transitive description: name: source_gen url: "https://pub.dartlang.org" source: hosted - version: "0.9.10+2" + version: "1.0.0" source_map_stack_trace: dependency: transitive description: name: source_map_stack_trace url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" source_maps: dependency: transitive description: name: source_maps url: "https://pub.dartlang.org" source: hosted - version: "0.10.8" + version: "0.10.10" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" stream_transform: dependency: transitive description: name: stream_transform url: "https://pub.dartlang.org" source: hosted - version: "0.0.20" + version: "2.0.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test: dependency: "direct dev" description: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.15.5" + version: "1.16.8" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.18+1" + version: "0.3.0" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.3.11+2" + version: "0.3.19" timing: dependency: transitive description: name: timing url: "https://pub.dartlang.org" source: hosted - version: "0.1.1+2" + version: "1.0.0" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" - uuid_enhanced: + version: "1.3.0" + uuid: dependency: transitive description: - name: uuid_enhanced + name: uuid url: "https://pub.dartlang.org" source: hosted - version: "3.0.2" + version: "3.0.4" vm_service: dependency: transitive description: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "6.2.0" watcher: dependency: transitive description: name: watcher url: "https://pub.dartlang.org" source: hosted - version: "0.9.7+12" + version: "1.0.0" web_socket_channel: dependency: transitive description: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "2.0.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol url: "https://pub.dartlang.org" source: hosted - version: "0.7.4" - websocket: - dependency: transitive - description: - name: websocket - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.5" + version: "1.0.0" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.1.0" sdks: - dart: ">=2.12.0-0 <3.0.0" + dart: ">=2.12.0 <3.0.0" diff --git a/example/hasura/pubspec.yaml b/example/hasura/pubspec.yaml index 40826556..4d76ede8 100644 --- a/example/hasura/pubspec.yaml +++ b/example/hasura/pubspec.yaml @@ -8,12 +8,12 @@ environment: sdk: ">=2.0.0 <3.0.0" dependencies: - http: ^0.12.0+2 - gql_websocket_link: ^0.1.1-alpha + http: ^0.13.1 + gql_websocket_link: ^0.3.0-nullsafety.1 dev_dependencies: - test: ^1.6.3 - build_runner: ^1.5.0 - json_serializable: ^3.0.0 + test: ^1.16.8 + build_runner: ^1.12.2 + json_serializable: ^4.1.0 artemis: path: ../../. diff --git a/example/pokemon/build.yaml b/example/pokemon/build.yaml index 0919dcef..5d6bc4a0 100644 --- a/example/pokemon/build.yaml +++ b/example/pokemon/build.yaml @@ -12,6 +12,9 @@ targets: - schema: pokemon.schema.graphql queries_glob: graphql/simple_query.query.graphql output: lib/graphql/simple_query.dart + - schema: pokemon.schema.graphql + queries_glob: graphql/complex_query.query.graphql + output: lib/graphql/complex_query.dart - schema: pokemon.schema.graphql queries_glob: graphql/big_query.query.graphql output: lib/graphql/big_query.dart diff --git a/example/pokemon/lib/graphql/big_query.dart b/example/pokemon/lib/graphql/big_query.dart index 2d9f0294..2b16f521 100644 --- a/example/pokemon/lib/graphql/big_query.dart +++ b/example/pokemon/lib/graphql/big_query.dart @@ -1,197 +1,2 @@ // GENERATED CODE - DO NOT MODIFY BY HAND - -import 'package:meta/meta.dart'; -import 'package:artemis/artemis.dart'; -import 'package:json_annotation/json_annotation.dart'; -import 'package:equatable/equatable.dart'; -import 'package:gql/ast.dart'; -part 'big_query.g.dart'; - -@JsonSerializable(explicitToJson: true) -class BigQuery$Query$Charmander with EquatableMixin { - BigQuery$Query$Charmander(); - - factory BigQuery$Query$Charmander.fromJson(Map json) => - _$BigQuery$Query$CharmanderFromJson(json); - - String number; - - List types; - - @override - List get props => [number, types]; - Map toJson() => _$BigQuery$Query$CharmanderToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class BigQuery$Query$Pokemon$Evolutions with EquatableMixin { - BigQuery$Query$Pokemon$Evolutions(); - - factory BigQuery$Query$Pokemon$Evolutions.fromJson( - Map json) => - _$BigQuery$Query$Pokemon$EvolutionsFromJson(json); - - String number; - - String name; - - @override - List get props => [number, name]; - Map toJson() => - _$BigQuery$Query$Pokemon$EvolutionsToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class BigQuery$Query$Pokemon with EquatableMixin { - BigQuery$Query$Pokemon(); - - factory BigQuery$Query$Pokemon.fromJson(Map json) => - _$BigQuery$Query$PokemonFromJson(json); - - String number; - - String name; - - List types; - - List evolutions; - - @override - List get props => [number, name, types, evolutions]; - Map toJson() => _$BigQuery$Query$PokemonToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class BigQuery$Query with EquatableMixin { - BigQuery$Query(); - - factory BigQuery$Query.fromJson(Map json) => - _$BigQuery$QueryFromJson(json); - - BigQuery$Query$Charmander charmander; - - List pokemons; - - @override - List get props => [charmander, pokemons]; - Map toJson() => _$BigQuery$QueryToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class BigQueryArguments extends JsonSerializable with EquatableMixin { - BigQueryArguments({@required this.quantity}); - - factory BigQueryArguments.fromJson(Map json) => - _$BigQueryArgumentsFromJson(json); - - final int quantity; - - @override - List get props => [quantity]; - Map toJson() => _$BigQueryArgumentsToJson(this); -} - -class BigQueryQuery extends GraphQLQuery { - BigQueryQuery({this.variables}); - - @override - final DocumentNode document = DocumentNode(definitions: [ - OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'big_query'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'quantity')), - type: - NamedTypeNode(name: NameNode(value: 'Int'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'pokemon'), - alias: NameNode(value: 'charmander'), - arguments: [ - ArgumentNode( - name: NameNode(value: 'name'), - value: StringValueNode(value: 'Charmander', isBlock: false)) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'number'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'types'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( - name: NameNode(value: 'pokemons'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'first'), - value: VariableNode(name: NameNode(value: 'quantity'))) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'number'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'name'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'types'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'evolutions'), - alias: NameNode(value: 'evolutions'), - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'number'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'name'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) - ])) - ]); - - @override - final String operationName = 'big_query'; - - @override - final BigQueryArguments variables; - - @override - List get props => [document, operationName, variables]; - @override - BigQuery$Query parse(Map json) => - BigQuery$Query.fromJson(json); -} +export 'big_query.graphql.dart'; diff --git a/example/pokemon/lib/graphql/big_query.graphql.dart b/example/pokemon/lib/graphql/big_query.graphql.dart new file mode 100644 index 00000000..84292eb7 --- /dev/null +++ b/example/pokemon/lib/graphql/big_query.graphql.dart @@ -0,0 +1,208 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// @dart = 2.12 + +import 'package:artemis/artemis.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:equatable/equatable.dart'; +import 'package:gql/ast.dart'; + +part 'big_query.graphql.g.dart'; + +@JsonSerializable(explicitToJson: true) +class BigQuery$Query$Charmander extends JsonSerializable with EquatableMixin { + BigQuery$Query$Charmander(); + + factory BigQuery$Query$Charmander.fromJson(Map json) => + _$BigQuery$Query$CharmanderFromJson(json); + + String? number; + + List? types; + + @override + List get props => [number, types]; + + Map toJson() => _$BigQuery$Query$CharmanderToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class BigQuery$Query$Pokemon$Evolutions extends JsonSerializable + with EquatableMixin { + BigQuery$Query$Pokemon$Evolutions(); + + factory BigQuery$Query$Pokemon$Evolutions.fromJson( + Map json) => + _$BigQuery$Query$Pokemon$EvolutionsFromJson(json); + + String? number; + + String? name; + + @override + List get props => [number, name]; + + Map toJson() => + _$BigQuery$Query$Pokemon$EvolutionsToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class BigQuery$Query$Pokemon extends JsonSerializable with EquatableMixin { + BigQuery$Query$Pokemon(); + + factory BigQuery$Query$Pokemon.fromJson(Map json) => + _$BigQuery$Query$PokemonFromJson(json); + + String? number; + + String? name; + + List? types; + + List? evolutions; + + @override + List get props => [number, name, types, evolutions]; + + Map toJson() => _$BigQuery$Query$PokemonToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class BigQuery$Query extends JsonSerializable with EquatableMixin { + BigQuery$Query(); + + factory BigQuery$Query.fromJson(Map json) => + _$BigQuery$QueryFromJson(json); + + BigQuery$Query$Charmander? charmander; + + List? pokemons; + + @override + List get props => [charmander, pokemons]; + + Map toJson() => _$BigQuery$QueryToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class BigQueryArguments extends JsonSerializable with EquatableMixin { + BigQueryArguments({required this.quantity}); + + @override + factory BigQueryArguments.fromJson(Map json) => + _$BigQueryArgumentsFromJson(json); + + late int quantity; + + @override + List get props => [quantity]; + + @override + Map toJson() => _$BigQueryArgumentsToJson(this); +} + +final BIG_QUERY_QUERY_DOCUMENT = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'big_query'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'quantity')), + type: NamedTypeNode(name: NameNode(value: 'Int'), isNonNull: true), + defaultValue: DefaultValueNode(value: null), + directives: []) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'pokemon'), + alias: NameNode(value: 'charmander'), + arguments: [ + ArgumentNode( + name: NameNode(value: 'name'), + value: StringValueNode(value: 'Charmander', isBlock: false)) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'number'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'types'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FieldNode( + name: NameNode(value: 'pokemons'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'first'), + value: VariableNode(name: NameNode(value: 'quantity'))) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'number'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'name'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'types'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'evolutions'), + alias: NameNode(value: 'evolutions'), + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'number'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'name'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])) + ])) + ])) +]); + +class BigQueryQuery extends GraphQLQuery { + BigQueryQuery({required this.variables}); + + @override + final DocumentNode document = BIG_QUERY_QUERY_DOCUMENT; + + @override + final String operationName = 'big_query'; + + @override + final BigQueryArguments variables; + + @override + List get props => [document, operationName, variables]; + + @override + BigQuery$Query parse(Map json) => + BigQuery$Query.fromJson(json); +} diff --git a/example/pokemon/lib/graphql/big_query.g.dart b/example/pokemon/lib/graphql/big_query.graphql.g.dart similarity index 77% rename from example/pokemon/lib/graphql/big_query.g.dart rename to example/pokemon/lib/graphql/big_query.graphql.g.dart index c91a15d1..9feca2b2 100644 --- a/example/pokemon/lib/graphql/big_query.g.dart +++ b/example/pokemon/lib/graphql/big_query.graphql.g.dart @@ -1,6 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// @dart=2.12 -part of 'big_query.dart'; +part of 'big_query.graphql.dart'; // ************************************************************************** // JsonSerializableGenerator @@ -9,8 +10,9 @@ part of 'big_query.dart'; BigQuery$Query$Charmander _$BigQuery$Query$CharmanderFromJson( Map json) { return BigQuery$Query$Charmander() - ..number = json['number'] as String - ..types = (json['types'] as List)?.map((e) => e as String)?.toList(); + ..number = json['number'] as String? + ..types = + (json['types'] as List?)?.map((e) => e as String?).toList(); } Map _$BigQuery$Query$CharmanderToJson( @@ -23,8 +25,8 @@ Map _$BigQuery$Query$CharmanderToJson( BigQuery$Query$Pokemon$Evolutions _$BigQuery$Query$Pokemon$EvolutionsFromJson( Map json) { return BigQuery$Query$Pokemon$Evolutions() - ..number = json['number'] as String - ..name = json['name'] as String; + ..number = json['number'] as String? + ..name = json['name'] as String?; } Map _$BigQuery$Query$Pokemon$EvolutionsToJson( @@ -37,15 +39,16 @@ Map _$BigQuery$Query$Pokemon$EvolutionsToJson( BigQuery$Query$Pokemon _$BigQuery$Query$PokemonFromJson( Map json) { return BigQuery$Query$Pokemon() - ..number = json['number'] as String - ..name = json['name'] as String - ..types = (json['types'] as List)?.map((e) => e as String)?.toList() - ..evolutions = (json['evolutions'] as List) + ..number = json['number'] as String? + ..name = json['name'] as String? + ..types = + (json['types'] as List?)?.map((e) => e as String?).toList() + ..evolutions = (json['evolutions'] as List?) ?.map((e) => e == null ? null : BigQuery$Query$Pokemon$Evolutions.fromJson( e as Map)) - ?.toList(); + .toList(); } Map _$BigQuery$Query$PokemonToJson( @@ -54,7 +57,7 @@ Map _$BigQuery$Query$PokemonToJson( 'number': instance.number, 'name': instance.name, 'types': instance.types, - 'evolutions': instance.evolutions?.map((e) => e?.toJson())?.toList(), + 'evolutions': instance.evolutions?.map((e) => e?.toJson()).toList(), }; BigQuery$Query _$BigQuery$QueryFromJson(Map json) { @@ -63,17 +66,17 @@ BigQuery$Query _$BigQuery$QueryFromJson(Map json) { ? null : BigQuery$Query$Charmander.fromJson( json['charmander'] as Map) - ..pokemons = (json['pokemons'] as List) + ..pokemons = (json['pokemons'] as List?) ?.map((e) => e == null ? null : BigQuery$Query$Pokemon.fromJson(e as Map)) - ?.toList(); + .toList(); } Map _$BigQuery$QueryToJson(BigQuery$Query instance) => { 'charmander': instance.charmander?.toJson(), - 'pokemons': instance.pokemons?.map((e) => e?.toJson())?.toList(), + 'pokemons': instance.pokemons?.map((e) => e?.toJson()).toList(), }; BigQueryArguments _$BigQueryArgumentsFromJson(Map json) { diff --git a/example/pokemon/lib/graphql/fragment_query.dart b/example/pokemon/lib/graphql/fragment_query.dart index 07871563..ebb735fd 100644 --- a/example/pokemon/lib/graphql/fragment_query.dart +++ b/example/pokemon/lib/graphql/fragment_query.dart @@ -1,181 +1,2 @@ // GENERATED CODE - DO NOT MODIFY BY HAND - -import 'package:meta/meta.dart'; -import 'package:artemis/artemis.dart'; -import 'package:json_annotation/json_annotation.dart'; -import 'package:equatable/equatable.dart'; -import 'package:gql/ast.dart'; -part 'fragment_query.g.dart'; - -mixin PokemonPartsMixin { - String number; - String name; - List types; -} - -@JsonSerializable(explicitToJson: true) -class FragmentQuery$Query$Charmander with EquatableMixin, PokemonPartsMixin { - FragmentQuery$Query$Charmander(); - - factory FragmentQuery$Query$Charmander.fromJson(Map json) => - _$FragmentQuery$Query$CharmanderFromJson(json); - - @override - List get props => [number, name, types]; - Map toJson() => _$FragmentQuery$Query$CharmanderToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class FragmentQuery$Query$Pokemon$Evolutions - with EquatableMixin, PokemonPartsMixin { - FragmentQuery$Query$Pokemon$Evolutions(); - - factory FragmentQuery$Query$Pokemon$Evolutions.fromJson( - Map json) => - _$FragmentQuery$Query$Pokemon$EvolutionsFromJson(json); - - @override - List get props => [number, name, types]; - Map toJson() => - _$FragmentQuery$Query$Pokemon$EvolutionsToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class FragmentQuery$Query$Pokemon with EquatableMixin, PokemonPartsMixin { - FragmentQuery$Query$Pokemon(); - - factory FragmentQuery$Query$Pokemon.fromJson(Map json) => - _$FragmentQuery$Query$PokemonFromJson(json); - - List evolutions; - - @override - List get props => [number, name, types, evolutions]; - Map toJson() => _$FragmentQuery$Query$PokemonToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class FragmentQuery$Query with EquatableMixin { - FragmentQuery$Query(); - - factory FragmentQuery$Query.fromJson(Map json) => - _$FragmentQuery$QueryFromJson(json); - - FragmentQuery$Query$Charmander charmander; - - List pokemons; - - @override - List get props => [charmander, pokemons]; - Map toJson() => _$FragmentQuery$QueryToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class FragmentQueryArguments extends JsonSerializable with EquatableMixin { - FragmentQueryArguments({@required this.quantity}); - - factory FragmentQueryArguments.fromJson(Map json) => - _$FragmentQueryArgumentsFromJson(json); - - final int quantity; - - @override - List get props => [quantity]; - Map toJson() => _$FragmentQueryArgumentsToJson(this); -} - -class FragmentQueryQuery - extends GraphQLQuery { - FragmentQueryQuery({this.variables}); - - @override - final DocumentNode document = DocumentNode(definitions: [ - OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'fragmentQuery'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'quantity')), - type: - NamedTypeNode(name: NameNode(value: 'Int'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'pokemon'), - alias: NameNode(value: 'charmander'), - arguments: [ - ArgumentNode( - name: NameNode(value: 'name'), - value: StringValueNode(value: 'Charmander', isBlock: false)) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'PokemonParts'), directives: []) - ])), - FieldNode( - name: NameNode(value: 'pokemons'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'first'), - value: VariableNode(name: NameNode(value: 'quantity'))) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'PokemonParts'), directives: []), - FieldNode( - name: NameNode(value: 'evolutions'), - alias: NameNode(value: 'evolutions'), - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'PokemonParts'), directives: []) - ])) - ])) - ])), - FragmentDefinitionNode( - name: NameNode(value: 'PokemonParts'), - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'Pokemon'), isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'number'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'name'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'types'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ]); - - @override - final String operationName = 'fragmentQuery'; - - @override - final FragmentQueryArguments variables; - - @override - List get props => [document, operationName, variables]; - @override - FragmentQuery$Query parse(Map json) => - FragmentQuery$Query.fromJson(json); -} +export 'fragment_query.graphql.dart'; diff --git a/example/pokemon/lib/graphql/fragment_query.graphql.dart b/example/pokemon/lib/graphql/fragment_query.graphql.dart new file mode 100644 index 00000000..bd31bf56 --- /dev/null +++ b/example/pokemon/lib/graphql/fragment_query.graphql.dart @@ -0,0 +1,193 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// @dart = 2.12 + +import 'package:artemis/artemis.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:equatable/equatable.dart'; +import 'package:gql/ast.dart'; + +part 'fragment_query.graphql.g.dart'; + +mixin PokemonPartsMixin { + String? number; + String? name; + List? types; +} + +@JsonSerializable(explicitToJson: true) +class FragmentQuery$Query$Charmander extends JsonSerializable + with EquatableMixin, PokemonPartsMixin { + FragmentQuery$Query$Charmander(); + + factory FragmentQuery$Query$Charmander.fromJson(Map json) => + _$FragmentQuery$Query$CharmanderFromJson(json); + + @override + List get props => [number, name, types]; + + Map toJson() => _$FragmentQuery$Query$CharmanderToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class FragmentQuery$Query$Pokemon$Evolutions extends JsonSerializable + with EquatableMixin, PokemonPartsMixin { + FragmentQuery$Query$Pokemon$Evolutions(); + + factory FragmentQuery$Query$Pokemon$Evolutions.fromJson( + Map json) => + _$FragmentQuery$Query$Pokemon$EvolutionsFromJson(json); + + @override + List get props => [number, name, types]; + + Map toJson() => + _$FragmentQuery$Query$Pokemon$EvolutionsToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class FragmentQuery$Query$Pokemon extends JsonSerializable + with EquatableMixin, PokemonPartsMixin { + FragmentQuery$Query$Pokemon(); + + factory FragmentQuery$Query$Pokemon.fromJson(Map json) => + _$FragmentQuery$Query$PokemonFromJson(json); + + List? evolutions; + + @override + List get props => [number, name, types, evolutions]; + + Map toJson() => _$FragmentQuery$Query$PokemonToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class FragmentQuery$Query extends JsonSerializable with EquatableMixin { + FragmentQuery$Query(); + + factory FragmentQuery$Query.fromJson(Map json) => + _$FragmentQuery$QueryFromJson(json); + + FragmentQuery$Query$Charmander? charmander; + + List? pokemons; + + @override + List get props => [charmander, pokemons]; + + Map toJson() => _$FragmentQuery$QueryToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class FragmentQueryArguments extends JsonSerializable with EquatableMixin { + FragmentQueryArguments({required this.quantity}); + + @override + factory FragmentQueryArguments.fromJson(Map json) => + _$FragmentQueryArgumentsFromJson(json); + + late int quantity; + + @override + List get props => [quantity]; + + @override + Map toJson() => _$FragmentQueryArgumentsToJson(this); +} + +final FRAGMENT_QUERY_QUERY_DOCUMENT = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'fragmentQuery'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'quantity')), + type: NamedTypeNode(name: NameNode(value: 'Int'), isNonNull: true), + defaultValue: DefaultValueNode(value: null), + directives: []) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'pokemon'), + alias: NameNode(value: 'charmander'), + arguments: [ + ArgumentNode( + name: NameNode(value: 'name'), + value: StringValueNode(value: 'Charmander', isBlock: false)) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'PokemonParts'), directives: []) + ])), + FieldNode( + name: NameNode(value: 'pokemons'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'first'), + value: VariableNode(name: NameNode(value: 'quantity'))) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'PokemonParts'), directives: []), + FieldNode( + name: NameNode(value: 'evolutions'), + alias: NameNode(value: 'evolutions'), + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'PokemonParts'), directives: []) + ])) + ])) + ])), + FragmentDefinitionNode( + name: NameNode(value: 'PokemonParts'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'Pokemon'), isNonNull: false)), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'number'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'name'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'types'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])) +]); + +class FragmentQueryQuery + extends GraphQLQuery { + FragmentQueryQuery({required this.variables}); + + @override + final DocumentNode document = FRAGMENT_QUERY_QUERY_DOCUMENT; + + @override + final String operationName = 'fragmentQuery'; + + @override + final FragmentQueryArguments variables; + + @override + List get props => [document, operationName, variables]; + + @override + FragmentQuery$Query parse(Map json) => + FragmentQuery$Query.fromJson(json); +} diff --git a/example/pokemon/lib/graphql/fragment_query.g.dart b/example/pokemon/lib/graphql/fragment_query.graphql.g.dart similarity index 76% rename from example/pokemon/lib/graphql/fragment_query.g.dart rename to example/pokemon/lib/graphql/fragment_query.graphql.g.dart index 6ed08421..3f965c43 100644 --- a/example/pokemon/lib/graphql/fragment_query.g.dart +++ b/example/pokemon/lib/graphql/fragment_query.graphql.g.dart @@ -1,6 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// @dart=2.12 -part of 'fragment_query.dart'; +part of 'fragment_query.graphql.dart'; // ************************************************************************** // JsonSerializableGenerator @@ -9,9 +10,10 @@ part of 'fragment_query.dart'; FragmentQuery$Query$Charmander _$FragmentQuery$Query$CharmanderFromJson( Map json) { return FragmentQuery$Query$Charmander() - ..number = json['number'] as String - ..name = json['name'] as String - ..types = (json['types'] as List)?.map((e) => e as String)?.toList(); + ..number = json['number'] as String? + ..name = json['name'] as String? + ..types = + (json['types'] as List?)?.map((e) => e as String?).toList(); } Map _$FragmentQuery$Query$CharmanderToJson( @@ -26,9 +28,10 @@ FragmentQuery$Query$Pokemon$Evolutions _$FragmentQuery$Query$Pokemon$EvolutionsFromJson( Map json) { return FragmentQuery$Query$Pokemon$Evolutions() - ..number = json['number'] as String - ..name = json['name'] as String - ..types = (json['types'] as List)?.map((e) => e as String)?.toList(); + ..number = json['number'] as String? + ..name = json['name'] as String? + ..types = + (json['types'] as List?)?.map((e) => e as String?).toList(); } Map _$FragmentQuery$Query$Pokemon$EvolutionsToJson( @@ -42,15 +45,16 @@ Map _$FragmentQuery$Query$Pokemon$EvolutionsToJson( FragmentQuery$Query$Pokemon _$FragmentQuery$Query$PokemonFromJson( Map json) { return FragmentQuery$Query$Pokemon() - ..number = json['number'] as String - ..name = json['name'] as String - ..types = (json['types'] as List)?.map((e) => e as String)?.toList() - ..evolutions = (json['evolutions'] as List) + ..number = json['number'] as String? + ..name = json['name'] as String? + ..types = + (json['types'] as List?)?.map((e) => e as String?).toList() + ..evolutions = (json['evolutions'] as List?) ?.map((e) => e == null ? null : FragmentQuery$Query$Pokemon$Evolutions.fromJson( e as Map)) - ?.toList(); + .toList(); } Map _$FragmentQuery$Query$PokemonToJson( @@ -59,7 +63,7 @@ Map _$FragmentQuery$Query$PokemonToJson( 'number': instance.number, 'name': instance.name, 'types': instance.types, - 'evolutions': instance.evolutions?.map((e) => e?.toJson())?.toList(), + 'evolutions': instance.evolutions?.map((e) => e?.toJson()).toList(), }; FragmentQuery$Query _$FragmentQuery$QueryFromJson(Map json) { @@ -68,18 +72,18 @@ FragmentQuery$Query _$FragmentQuery$QueryFromJson(Map json) { ? null : FragmentQuery$Query$Charmander.fromJson( json['charmander'] as Map) - ..pokemons = (json['pokemons'] as List) + ..pokemons = (json['pokemons'] as List?) ?.map((e) => e == null ? null : FragmentQuery$Query$Pokemon.fromJson(e as Map)) - ?.toList(); + .toList(); } Map _$FragmentQuery$QueryToJson( FragmentQuery$Query instance) => { 'charmander': instance.charmander?.toJson(), - 'pokemons': instance.pokemons?.map((e) => e?.toJson())?.toList(), + 'pokemons': instance.pokemons?.map((e) => e?.toJson()).toList(), }; FragmentQueryArguments _$FragmentQueryArgumentsFromJson( diff --git a/example/pokemon/lib/graphql/fragments_glob.dart b/example/pokemon/lib/graphql/fragments_glob.dart index cb79c7b7..6c12f143 100644 --- a/example/pokemon/lib/graphql/fragments_glob.dart +++ b/example/pokemon/lib/graphql/fragments_glob.dart @@ -1,224 +1,2 @@ // GENERATED CODE - DO NOT MODIFY BY HAND - -import 'package:artemis/artemis.dart'; -import 'package:json_annotation/json_annotation.dart'; -import 'package:equatable/equatable.dart'; -import 'package:gql/ast.dart'; -part 'fragments_glob.g.dart'; - -mixin PokemonMixin { - String id; - PokemonMixin$PokemonDimension weight; - PokemonMixin$PokemonAttack attacks; -} -mixin WeightMixin { - String minimum; -} -mixin PokemonAttackMixin { - List special; -} -mixin AttackMixin { - String name; -} - -@JsonSerializable(explicitToJson: true) -class FragmentsGlob$Query$Pokemon$Pokemon with EquatableMixin, PokemonMixin { - FragmentsGlob$Query$Pokemon$Pokemon(); - - factory FragmentsGlob$Query$Pokemon$Pokemon.fromJson( - Map json) => - _$FragmentsGlob$Query$Pokemon$PokemonFromJson(json); - - @override - List get props => [id, weight, attacks]; - Map toJson() => - _$FragmentsGlob$Query$Pokemon$PokemonToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class FragmentsGlob$Query$Pokemon with EquatableMixin, PokemonMixin { - FragmentsGlob$Query$Pokemon(); - - factory FragmentsGlob$Query$Pokemon.fromJson(Map json) => - _$FragmentsGlob$Query$PokemonFromJson(json); - - List evolutions; - - @override - List get props => [id, weight, attacks, evolutions]; - Map toJson() => _$FragmentsGlob$Query$PokemonToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class FragmentsGlob$Query with EquatableMixin { - FragmentsGlob$Query(); - - factory FragmentsGlob$Query.fromJson(Map json) => - _$FragmentsGlob$QueryFromJson(json); - - FragmentsGlob$Query$Pokemon pokemon; - - @override - List get props => [pokemon]; - Map toJson() => _$FragmentsGlob$QueryToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class PokemonMixin$PokemonDimension with EquatableMixin, WeightMixin { - PokemonMixin$PokemonDimension(); - - factory PokemonMixin$PokemonDimension.fromJson(Map json) => - _$PokemonMixin$PokemonDimensionFromJson(json); - - @override - List get props => [minimum]; - Map toJson() => _$PokemonMixin$PokemonDimensionToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class PokemonMixin$PokemonAttack with EquatableMixin, PokemonAttackMixin { - PokemonMixin$PokemonAttack(); - - factory PokemonMixin$PokemonAttack.fromJson(Map json) => - _$PokemonMixin$PokemonAttackFromJson(json); - - @override - List get props => [special]; - Map toJson() => _$PokemonMixin$PokemonAttackToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class PokemonAttackMixin$Attack with EquatableMixin, AttackMixin { - PokemonAttackMixin$Attack(); - - factory PokemonAttackMixin$Attack.fromJson(Map json) => - _$PokemonAttackMixin$AttackFromJson(json); - - @override - List get props => [name]; - Map toJson() => _$PokemonAttackMixin$AttackToJson(this); -} - -class FragmentsGlobQuery - extends GraphQLQuery { - FragmentsGlobQuery(); - - @override - final DocumentNode document = DocumentNode(definitions: [ - OperationDefinitionNode( - type: OperationType.query, - name: null, - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'pokemon'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'name'), - value: StringValueNode(value: 'Pikachu', isBlock: false)) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'Pokemon'), directives: []), - FieldNode( - name: NameNode(value: 'evolutions'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'Pokemon'), directives: []) - ])) - ])) - ])), - FragmentDefinitionNode( - name: NameNode(value: 'Pokemon'), - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'Pokemon'), isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'id'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'weight'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'weight'), directives: []) - ])), - FieldNode( - name: NameNode(value: 'attacks'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'pokemonAttack'), directives: []) - ])) - ])), - FragmentDefinitionNode( - name: NameNode(value: 'weight'), - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'PokemonDimension'), isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'minimum'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FragmentDefinitionNode( - name: NameNode(value: 'pokemonAttack'), - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'PokemonAttack'), isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'special'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'attack'), directives: []) - ])) - ])), - FragmentDefinitionNode( - name: NameNode(value: 'attack'), - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'Attack'), isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'name'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ]); - - @override - final String operationName = 'fragments_glob'; - - @override - List get props => [document, operationName]; - @override - FragmentsGlob$Query parse(Map json) => - FragmentsGlob$Query.fromJson(json); -} +export 'fragments_glob.graphql.dart'; diff --git a/example/pokemon/lib/graphql/fragments_glob.graphql.dart b/example/pokemon/lib/graphql/fragments_glob.graphql.dart new file mode 100644 index 00000000..a57d4a20 --- /dev/null +++ b/example/pokemon/lib/graphql/fragments_glob.graphql.dart @@ -0,0 +1,239 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// @dart = 2.12 + +import 'package:artemis/artemis.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:equatable/equatable.dart'; +import 'package:gql/ast.dart'; + +part 'fragments_glob.graphql.g.dart'; + +mixin PokemonMixin { + late String id; + PokemonMixin$PokemonDimension? weight; + PokemonMixin$PokemonAttack? attacks; +} +mixin WeightMixin { + String? minimum; +} +mixin PokemonAttackMixin { + List? special; +} +mixin AttackMixin { + String? name; +} + +@JsonSerializable(explicitToJson: true) +class FragmentsGlob$Query$Pokemon$Pokemon extends JsonSerializable + with EquatableMixin, PokemonMixin { + FragmentsGlob$Query$Pokemon$Pokemon(); + + factory FragmentsGlob$Query$Pokemon$Pokemon.fromJson( + Map json) => + _$FragmentsGlob$Query$Pokemon$PokemonFromJson(json); + + @override + List get props => [id, weight, attacks]; + + Map toJson() => + _$FragmentsGlob$Query$Pokemon$PokemonToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class FragmentsGlob$Query$Pokemon extends JsonSerializable + with EquatableMixin, PokemonMixin { + FragmentsGlob$Query$Pokemon(); + + factory FragmentsGlob$Query$Pokemon.fromJson(Map json) => + _$FragmentsGlob$Query$PokemonFromJson(json); + + List? evolutions; + + @override + List get props => [id, weight, attacks, evolutions]; + + Map toJson() => _$FragmentsGlob$Query$PokemonToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class FragmentsGlob$Query extends JsonSerializable with EquatableMixin { + FragmentsGlob$Query(); + + factory FragmentsGlob$Query.fromJson(Map json) => + _$FragmentsGlob$QueryFromJson(json); + + FragmentsGlob$Query$Pokemon? pokemon; + + @override + List get props => [pokemon]; + + Map toJson() => _$FragmentsGlob$QueryToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class PokemonMixin$PokemonDimension extends JsonSerializable + with EquatableMixin, WeightMixin { + PokemonMixin$PokemonDimension(); + + factory PokemonMixin$PokemonDimension.fromJson(Map json) => + _$PokemonMixin$PokemonDimensionFromJson(json); + + @override + List get props => [minimum]; + + Map toJson() => _$PokemonMixin$PokemonDimensionToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class PokemonMixin$PokemonAttack extends JsonSerializable + with EquatableMixin, PokemonAttackMixin { + PokemonMixin$PokemonAttack(); + + factory PokemonMixin$PokemonAttack.fromJson(Map json) => + _$PokemonMixin$PokemonAttackFromJson(json); + + @override + List get props => [special]; + + Map toJson() => _$PokemonMixin$PokemonAttackToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class PokemonAttackMixin$Attack extends JsonSerializable + with EquatableMixin, AttackMixin { + PokemonAttackMixin$Attack(); + + factory PokemonAttackMixin$Attack.fromJson(Map json) => + _$PokemonAttackMixin$AttackFromJson(json); + + @override + List get props => [name]; + + Map toJson() => _$PokemonAttackMixin$AttackToJson(this); +} + +final FRAGMENTS_GLOB_QUERY_DOCUMENT = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: null, + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'pokemon'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'name'), + value: StringValueNode(value: 'Pikachu', isBlock: false)) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'Pokemon'), directives: []), + FieldNode( + name: NameNode(value: 'evolutions'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'Pokemon'), directives: []) + ])) + ])) + ])), + FragmentDefinitionNode( + name: NameNode(value: 'Pokemon'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'Pokemon'), isNonNull: false)), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'id'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'weight'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'weight'), directives: []) + ])), + FieldNode( + name: NameNode(value: 'attacks'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'pokemonAttack'), directives: []) + ])) + ])), + FragmentDefinitionNode( + name: NameNode(value: 'weight'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'PokemonDimension'), isNonNull: false)), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'minimum'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FragmentDefinitionNode( + name: NameNode(value: 'pokemonAttack'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'PokemonAttack'), isNonNull: false)), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'special'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'attack'), directives: []) + ])) + ])), + FragmentDefinitionNode( + name: NameNode(value: 'attack'), + typeCondition: TypeConditionNode( + on: NamedTypeNode(name: NameNode(value: 'Attack'), isNonNull: false)), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'name'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])) +]); + +class FragmentsGlobQuery + extends GraphQLQuery { + FragmentsGlobQuery(); + + @override + final DocumentNode document = FRAGMENTS_GLOB_QUERY_DOCUMENT; + + @override + final String operationName = 'fragments_glob'; + + @override + List get props => [document, operationName]; + + @override + FragmentsGlob$Query parse(Map json) => + FragmentsGlob$Query.fromJson(json); +} diff --git a/example/pokemon/lib/graphql/fragments_glob.g.dart b/example/pokemon/lib/graphql/fragments_glob.graphql.g.dart similarity index 91% rename from example/pokemon/lib/graphql/fragments_glob.g.dart rename to example/pokemon/lib/graphql/fragments_glob.graphql.g.dart index 5c1bd60b..71d0ac51 100644 --- a/example/pokemon/lib/graphql/fragments_glob.g.dart +++ b/example/pokemon/lib/graphql/fragments_glob.graphql.g.dart @@ -1,6 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// @dart=2.12 -part of 'fragments_glob.dart'; +part of 'fragments_glob.graphql.dart'; // ************************************************************************** // JsonSerializableGenerator @@ -40,12 +41,12 @@ FragmentsGlob$Query$Pokemon _$FragmentsGlob$Query$PokemonFromJson( ? null : PokemonMixin$PokemonAttack.fromJson( json['attacks'] as Map) - ..evolutions = (json['evolutions'] as List) + ..evolutions = (json['evolutions'] as List?) ?.map((e) => e == null ? null : FragmentsGlob$Query$Pokemon$Pokemon.fromJson( e as Map)) - ?.toList(); + .toList(); } Map _$FragmentsGlob$Query$PokemonToJson( @@ -54,7 +55,7 @@ Map _$FragmentsGlob$Query$PokemonToJson( 'id': instance.id, 'weight': instance.weight?.toJson(), 'attacks': instance.attacks?.toJson(), - 'evolutions': instance.evolutions?.map((e) => e?.toJson())?.toList(), + 'evolutions': instance.evolutions?.map((e) => e?.toJson()).toList(), }; FragmentsGlob$Query _$FragmentsGlob$QueryFromJson(Map json) { @@ -73,7 +74,7 @@ Map _$FragmentsGlob$QueryToJson( PokemonMixin$PokemonDimension _$PokemonMixin$PokemonDimensionFromJson( Map json) { - return PokemonMixin$PokemonDimension()..minimum = json['minimum'] as String; + return PokemonMixin$PokemonDimension()..minimum = json['minimum'] as String?; } Map _$PokemonMixin$PokemonDimensionToJson( @@ -85,22 +86,22 @@ Map _$PokemonMixin$PokemonDimensionToJson( PokemonMixin$PokemonAttack _$PokemonMixin$PokemonAttackFromJson( Map json) { return PokemonMixin$PokemonAttack() - ..special = (json['special'] as List) + ..special = (json['special'] as List?) ?.map((e) => e == null ? null : PokemonAttackMixin$Attack.fromJson(e as Map)) - ?.toList(); + .toList(); } Map _$PokemonMixin$PokemonAttackToJson( PokemonMixin$PokemonAttack instance) => { - 'special': instance.special?.map((e) => e?.toJson())?.toList(), + 'special': instance.special?.map((e) => e?.toJson()).toList(), }; PokemonAttackMixin$Attack _$PokemonAttackMixin$AttackFromJson( Map json) { - return PokemonAttackMixin$Attack()..name = json['name'] as String; + return PokemonAttackMixin$Attack()..name = json['name'] as String?; } Map _$PokemonAttackMixin$AttackToJson( diff --git a/example/pokemon/lib/graphql/simple_query.dart b/example/pokemon/lib/graphql/simple_query.dart index d709cdfb..11de129b 100644 --- a/example/pokemon/lib/graphql/simple_query.dart +++ b/example/pokemon/lib/graphql/simple_query.dart @@ -1,85 +1,2 @@ // GENERATED CODE - DO NOT MODIFY BY HAND - -import 'package:artemis/artemis.dart'; -import 'package:json_annotation/json_annotation.dart'; -import 'package:equatable/equatable.dart'; -import 'package:gql/ast.dart'; -part 'simple_query.g.dart'; - -@JsonSerializable(explicitToJson: true) -class SimpleQuery$Query$Pokemon with EquatableMixin { - SimpleQuery$Query$Pokemon(); - - factory SimpleQuery$Query$Pokemon.fromJson(Map json) => - _$SimpleQuery$Query$PokemonFromJson(json); - - String number; - - List types; - - @override - List get props => [number, types]; - Map toJson() => _$SimpleQuery$Query$PokemonToJson(this); -} - -@JsonSerializable(explicitToJson: true) -class SimpleQuery$Query with EquatableMixin { - SimpleQuery$Query(); - - factory SimpleQuery$Query.fromJson(Map json) => - _$SimpleQuery$QueryFromJson(json); - - SimpleQuery$Query$Pokemon pokemon; - - @override - List get props => [pokemon]; - Map toJson() => _$SimpleQuery$QueryToJson(this); -} - -class SimpleQueryQuery - extends GraphQLQuery { - SimpleQueryQuery(); - - @override - final DocumentNode document = DocumentNode(definitions: [ - OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'simple_query'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'pokemon'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'name'), - value: StringValueNode(value: 'Charmander', isBlock: false)) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'number'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'types'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) - ]); - - @override - final String operationName = 'simple_query'; - - @override - List get props => [document, operationName]; - @override - SimpleQuery$Query parse(Map json) => - SimpleQuery$Query.fromJson(json); -} +export 'simple_query.graphql.dart'; diff --git a/example/pokemon/lib/graphql/simple_query.graphql.dart b/example/pokemon/lib/graphql/simple_query.graphql.dart new file mode 100644 index 00000000..a5d4330c --- /dev/null +++ b/example/pokemon/lib/graphql/simple_query.graphql.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// @dart = 2.12 + +import 'package:artemis/artemis.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:equatable/equatable.dart'; +import 'package:gql/ast.dart'; + +part 'simple_query.graphql.g.dart'; + +@JsonSerializable(explicitToJson: true) +class SimpleQuery$Query$Pokemon extends JsonSerializable with EquatableMixin { + SimpleQuery$Query$Pokemon(); + + factory SimpleQuery$Query$Pokemon.fromJson(Map json) => + _$SimpleQuery$Query$PokemonFromJson(json); + + String? number; + + List? types; + + @override + List get props => [number, types]; + + Map toJson() => _$SimpleQuery$Query$PokemonToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class SimpleQuery$Query extends JsonSerializable with EquatableMixin { + SimpleQuery$Query(); + + factory SimpleQuery$Query.fromJson(Map json) => + _$SimpleQuery$QueryFromJson(json); + + SimpleQuery$Query$Pokemon? pokemon; + + @override + List get props => [pokemon]; + + Map toJson() => _$SimpleQuery$QueryToJson(this); +} + +final SIMPLE_QUERY_QUERY_DOCUMENT = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'simple_query'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'pokemon'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'name'), + value: StringValueNode(value: 'Charmander', isBlock: false)) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'number'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'types'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])) + ])) +]); + +class SimpleQueryQuery + extends GraphQLQuery { + SimpleQueryQuery(); + + @override + final DocumentNode document = SIMPLE_QUERY_QUERY_DOCUMENT; + + @override + final String operationName = 'simple_query'; + + @override + List get props => [document, operationName]; + + @override + SimpleQuery$Query parse(Map json) => + SimpleQuery$Query.fromJson(json); +} diff --git a/example/pokemon/lib/graphql/simple_query.g.dart b/example/pokemon/lib/graphql/simple_query.graphql.g.dart similarity index 84% rename from example/pokemon/lib/graphql/simple_query.g.dart rename to example/pokemon/lib/graphql/simple_query.graphql.g.dart index ada7d1bd..64b5bf4b 100644 --- a/example/pokemon/lib/graphql/simple_query.g.dart +++ b/example/pokemon/lib/graphql/simple_query.graphql.g.dart @@ -1,6 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// @dart=2.12 -part of 'simple_query.dart'; +part of 'simple_query.graphql.dart'; // ************************************************************************** // JsonSerializableGenerator @@ -9,8 +10,9 @@ part of 'simple_query.dart'; SimpleQuery$Query$Pokemon _$SimpleQuery$Query$PokemonFromJson( Map json) { return SimpleQuery$Query$Pokemon() - ..number = json['number'] as String - ..types = (json['types'] as List)?.map((e) => e as String)?.toList(); + ..number = json['number'] as String? + ..types = + (json['types'] as List?)?.map((e) => e as String?).toList(); } Map _$SimpleQuery$Query$PokemonToJson( diff --git a/example/pokemon/pubspec.lock b/example/pokemon/pubspec.lock index bfaa9c18..a0dd32c1 100644 --- a/example/pokemon/pubspec.lock +++ b/example/pokemon/pubspec.lock @@ -7,294 +7,301 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "12.0.0" + version: "20.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "0.40.6" + version: "1.4.0" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.5.2" + version: "2.0.0" artemis: dependency: "direct dev" description: path: "../.." relative: true source: path - version: "6.20.1-beta.2" + version: "7.0.0-beta.3.3" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.1.0" build: dependency: transitive description: name: build url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" + version: "2.0.0" build_config: dependency: transitive description: name: build_config url: "https://pub.dartlang.org" source: hosted - version: "0.4.5" + version: "0.4.7" build_daemon: dependency: transitive description: name: build_daemon url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.10" build_resolvers: dependency: transitive description: name: build_resolvers url: "https://pub.dartlang.org" source: hosted - version: "1.5.3" + version: "2.0.0" build_runner: dependency: "direct dev" description: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "1.11.1" + version: "1.12.2" build_runner_core: dependency: transitive description: name: build_runner_core url: "https://pub.dartlang.org" source: hosted - version: "6.1.7" + version: "6.1.12" built_collection: dependency: transitive description: name: built_collection url: "https://pub.dartlang.org" source: hosted - version: "4.3.0" + version: "5.0.0" built_value: dependency: transitive description: name: built_value url: "https://pub.dartlang.org" source: hosted - version: "7.0.0" + version: "8.0.4" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.0" checked_yaml: dependency: transitive description: name: checked_yaml url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "2.0.1" cli_util: dependency: transitive description: name: cli_util url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.3.0" code_builder: dependency: transitive description: name: code_builder url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "3.7.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.13" + version: "1.15.0" convert: dependency: transitive description: name: convert url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "3.0.0" coverage: dependency: transitive description: name: coverage url: "https://pub.dartlang.org" source: hosted - version: "0.14.2" + version: "1.0.2" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "3.0.1" dart_style: dependency: transitive description: name: dart_style url: "https://pub.dartlang.org" source: hosted - version: "1.3.10" + version: "2.0.0" equatable: dependency: transitive description: name: equatable url: "https://pub.dartlang.org" source: hosted - version: "1.2.5" + version: "2.0.0" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.0" fixnum: dependency: transitive description: name: fixnum url: "https://pub.dartlang.org" source: hosted - version: "0.10.11" + version: "1.0.0" glob: dependency: transitive description: name: glob url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "2.0.1" gql: dependency: transitive description: name: gql url: "https://pub.dartlang.org" source: hosted - version: "0.12.4" - gql_code_gen: + version: "0.13.0-nullsafety.2" + gql_code_builder: dependency: transitive description: - name: gql_code_gen + name: gql_code_builder url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" + version: "0.2.0-nullsafety.0" gql_dedupe_link: dependency: transitive description: name: gql_dedupe_link url: "https://pub.dartlang.org" source: hosted - version: "1.0.10" + version: "2.0.0-nullsafety.1" gql_exec: dependency: transitive description: name: gql_exec url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.3.0-nullsafety.2" gql_http_link: dependency: transitive description: name: gql_http_link url: "https://pub.dartlang.org" source: hosted - version: "0.3.2" + version: "0.4.0-nullsafety.1" gql_link: dependency: transitive description: name: gql_link url: "https://pub.dartlang.org" source: hosted - version: "0.3.1" + version: "0.4.0-nullsafety.3" graphs: dependency: transitive description: name: graphs url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "1.0.0" http: dependency: "direct main" description: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.2" + version: "0.13.1" http_multi_server: dependency: transitive description: name: http_multi_server url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "3.0.0" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.1.4" + version: "4.0.0" io: dependency: transitive description: name: io url: "https://pub.dartlang.org" source: hosted - version: "0.3.3" + version: "1.0.0" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.1+1" + version: "0.6.3" json_annotation: dependency: transitive description: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "3.1.1" + version: "4.0.1" json_serializable: dependency: "direct dev" description: name: json_serializable url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "4.1.0" logging: dependency: transitive description: name: logging url: "https://pub.dartlang.org" source: hosted - version: "0.11.3+2" + version: "1.0.1" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.9" + version: "0.12.10" meta: dependency: transitive description: @@ -308,251 +315,223 @@ packages: name: mime url: "https://pub.dartlang.org" source: hosted - version: "0.9.6+3" - node_interop: - dependency: transitive - description: - name: node_interop - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.3" - node_io: - dependency: transitive - description: - name: node_io - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1+2" + version: "1.0.0" node_preamble: dependency: transitive description: name: node_preamble url: "https://pub.dartlang.org" source: hosted - version: "1.4.8" + version: "2.0.0" package_config: dependency: transitive description: name: package_config url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" - package_resolver: - dependency: transitive - description: - name: package_resolver - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.10" + version: "2.0.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.8.0+1" + version: "1.11.0" pool: dependency: transitive description: name: pool url: "https://pub.dartlang.org" source: hosted - version: "1.4.0" + version: "1.5.0" pub_semver: dependency: transitive description: name: pub_semver url: "https://pub.dartlang.org" source: hosted - version: "1.4.2" + version: "2.0.0" pubspec_parse: dependency: transitive description: name: pubspec_parse url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.2+1" + version: "1.0.0" recase: dependency: transitive description: name: recase url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "4.0.0-nullsafety.0" shelf: dependency: transitive description: name: shelf url: "https://pub.dartlang.org" source: hosted - version: "0.7.5" + version: "1.1.0" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "3.0.0" shelf_static: dependency: transitive description: name: shelf_static url: "https://pub.dartlang.org" source: hosted - version: "0.2.8" + version: "1.0.0" shelf_web_socket: dependency: transitive description: name: shelf_web_socket url: "https://pub.dartlang.org" source: hosted - version: "0.2.3" + version: "1.0.1" source_gen: dependency: transitive description: name: source_gen url: "https://pub.dartlang.org" source: hosted - version: "0.9.10+2" + version: "1.0.0" source_map_stack_trace: dependency: transitive description: name: source_map_stack_trace url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" source_maps: dependency: transitive description: name: source_maps url: "https://pub.dartlang.org" source: hosted - version: "0.10.8" + version: "0.10.10" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" stream_transform: dependency: transitive description: name: stream_transform url: "https://pub.dartlang.org" source: hosted - version: "0.0.20" + version: "2.0.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test: dependency: "direct dev" description: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.15.5" + version: "1.16.8" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.18+1" + version: "0.3.0" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.3.11+2" + version: "0.3.19" timing: dependency: transitive description: name: timing url: "https://pub.dartlang.org" source: hosted - version: "0.1.1+2" + version: "1.0.0" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vm_service: dependency: transitive description: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "6.2.0" watcher: dependency: transitive description: name: watcher url: "https://pub.dartlang.org" source: hosted - version: "0.9.7+12" + version: "1.0.0" web_socket_channel: dependency: transitive description: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "2.0.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol url: "https://pub.dartlang.org" source: hosted - version: "0.7.4" + version: "1.0.0" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.1.0" sdks: - dart: ">=2.12.0-0 <3.0.0" + dart: ">=2.12.0 <3.0.0" diff --git a/example/pokemon/pubspec.yaml b/example/pokemon/pubspec.yaml index 2bb65247..9d3437ba 100644 --- a/example/pokemon/pubspec.yaml +++ b/example/pokemon/pubspec.yaml @@ -5,14 +5,14 @@ authors: - Igor Borges environment: - sdk: '>=2.0.0 <3.0.0' + sdk: '>=2.12.0 <3.0.0' dependencies: - http: ^0.12.0+2 + http: ^0.13.1 dev_dependencies: - test: ^1.6.3 - build_runner: ^1.5.0 - json_serializable: ^3.0.0 + test: ^1.16.8 + build_runner: ^1.12.2 + json_serializable: ^4.1.0 artemis: path: ../../. diff --git a/lib/visitor/generator_visitor.dart b/lib/visitor/generator_visitor.dart index 3b765ca8..31a91bfe 100644 --- a/lib/visitor/generator_visitor.dart +++ b/lib/visitor/generator_visitor.dart @@ -96,11 +96,6 @@ class GeneratorVisitor extends RecursiveVisitor { final nextType = gql.getTypeByName(context.schema, node.typeCondition!.on, context: 'inline fragment'); - // final fragmentName = FragmentName.fromPath( - // path: context - // .sameTypeWithNoPath(alias: FragmentName(name: node.name.value)) - // .fullPathName()); - if (nextType.name.value == context.currentType!.name.value) { final visitor = GeneratorVisitor( context: context.nextTypeWithSamePath( @@ -113,7 +108,6 @@ class GeneratorVisitor extends RecursiveVisitor { ), ); node.selectionSet.visitChildren(visitor); - print('test'); } else { final visitor = GeneratorVisitor( context: context.next( diff --git a/pubspec.yaml b/pubspec.yaml index 244222df..5af88ff7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: artemis -version: 7.0.0-beta.4 +version: 7.0.0-beta.5 description: Build dart types from GraphQL schemas and queries (using Introspection Query). homepage: https://github.com/comigor/artemis