From 134f6b7cee4f48fb11be2ad8f14cd9e1322c7268 Mon Sep 17 00:00:00 2001 From: Vasiliy Ditsyak Date: Sat, 15 Oct 2022 16:00:31 +0200 Subject: [PATCH] package update --- .github/workflows/pull_request.yaml | 14 +- .github/workflows/push.yaml | 6 +- CHANGELOG.md | 147 +++++++++- .../lib/queries/ed_sheeran.query.graphql.dart | 1 + lib/generator/ephemeral_data.dart | 1 + lib/generator/print_helpers.dart | 1 - pubspec.yaml | 36 +-- test/generator/print_helpers_test.dart | 58 ++-- .../aliases/alias_on_leaves_test.dart | 1 - .../aliases/alias_on_object_test.dart | 1 - .../append_type_name_test.dart | 96 +++--- .../field_not_found_mutation_test.dart | 6 +- .../ast_schema/input_types_test.dart | 7 +- .../ast_schema/missing_schema_test.dart | 1 - .../multiple_schema_mappint_test.dart | 179 ++++++------ .../deprecated_enum_value_test.dart | 1 - .../deprecated/deprecated_field_test.dart | 1 - .../deprecated_input_object_field_test.dart | 69 +++-- .../deprecated_interface_field_test.dart | 1 - .../enums/enum_duplication_test.dart | 1 - .../query_generator/enums/enum_list_test.dart | 1 - .../enums/filter_enum_test.dart | 1 - .../enums/input_enum_list_test.dart | 95 +++--- .../enums/input_enum_test.dart | 139 +++++---- .../query_generator/enums/kw_prefix_test.dart | 6 +- .../enums/query_enum_test.dart | 1 - test/query_generator/forwarder_test.dart | 1 - .../fragments/fragment_duplication_test.dart | 1 - .../fragment_glob_schema_level_test.dart | 219 ++++++++------ .../fragments/fragment_glob_test.dart | 219 ++++++++------ .../fragment_multiple_queries_test.dart | 202 +++++++------ .../fragments/fragment_on_fragments_test.dart | 1 - .../fragments/fragments_multiple_test.dart | 258 ++++++++-------- .../fragments/fragments_test.dart | 1 - ...iple_references_on_simple_naming_test.dart | 1 - .../interface_fragment_glob_test.dart | 1 - .../interface_possible_types_test.dart | 1 - .../interfaces/interface_test.dart | 1 - .../multiple_operations_per_file_test.dart | 190 ++++++------ .../multiple_queries_test.dart | 1 - .../complex_input_objects_test.dart | 71 +++-- .../custom_scalars_on_input_objects_test.dart | 124 ++++---- .../filter_input_objects_test.dart | 64 ++-- .../input_duplication_test.dart | 132 +++++---- .../mutations_and_inputs/mutations_test.dart | 127 ++++---- .../non_nullable_list_inputs_test.dart | 275 ++++++++++-------- .../recursive_input_test.dart | 6 +- .../naming/casing_conversion_test.dart | 129 ++++---- .../naming/simple_naming_test.dart | 47 +-- test/query_generator/nnbd_test.dart | 2 - .../query_generator/query_generator_test.dart | 2 - .../scalars/custom_scalars_test.dart | 3 - .../query_generator/scalars/scalars_test.dart | 1 - .../scalars/unused_custom_scalars_test.dart | 1 - test/query_generator/subscription_test.dart | 1 - .../union/union_types_test.dart | 1 - .../union/union_with_nested_types_test.dart | 1 - 57 files changed, 1691 insertions(+), 1264 deletions(-) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 3b4ecb7e..d47989e2 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v2 - uses: dart-lang/setup-dart@v1 with: - sdk: 2.14.0 + sdk: 2.18.0 - id: install name: Install dependencies run: dart pub get @@ -26,25 +26,21 @@ jobs: run: dart format --set-exit-if-changed . - name: Run analyzer and annotate if: always() && steps.install.outcome == 'success' - uses: kitek/dartanalyzer-annotations-action@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - check_name: Check code style - commit_sha: ${{ github.event.pull_request.head.sha }} + # https://github.com/kitek/dartanalyzer-annotations-action was too outdated and seems does not have any support + run: dart analyze --fatal-infos test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: dart-lang/setup-dart@v1 with: - sdk: 2.14.0 + sdk: 2.18.0 - id: install name: Install dependencies run: dart pub get - name: Test if: always() && steps.install.outcome == 'success' - run: pub run test --file-reporter='json:test-report.json' + run: dart run test --file-reporter='json:test-report.json' continue-on-error: true - name: Annotate with test errors uses: rodrigost23/dart-test-annotations@v1.0 diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index be76f257..5e549cd9 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v2 - uses: dart-lang/setup-dart@v1 with: - sdk: 2.14.0 + sdk: 2.18.0 - id: install name: Install dependencies run: dart pub get @@ -26,13 +26,13 @@ jobs: - uses: actions/checkout@v2 - uses: dart-lang/setup-dart@v1 with: - sdk: 2.14.0 + sdk: 2.18.0 - id: install name: Install dependencies run: dart pub get - name: Test if: always() && steps.install.outcome == 'success' - run: pub run test + run: dart run test create-tag-and-release: needs: - lint diff --git a/CHANGELOG.md b/CHANGELOG.md index e9de45a9..929d943c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 7.10.0-beta + +- package update + ## 7.9.0-beta - common fragments overlap fix @@ -176,117 +180,155 @@ - Code generated by Artemis is now nnbd-compliant ## 6.20.1-beta.2 + - Add codespaces folder ## 6.20.1-beta.1 + - Allow for auto generated response and inputs to extend JsonSerializable ## 6.19.3-beta.1 + - bugfix of append typename - common fragments ## 6.19.2-beta.1 + - bugfix of append typename ## 6.19.1-beta.1 + - Append typename flag ## 6.18.2 + - Merging beta into master ## 6.18.1-beta.1 + - add unknownEnumValue on list enums https://github.com/comigor/artemis/issues/246 ## 6.17.3 + - Add test case, warning to README, fix CI pipeline ## 6.17.2 + - Update dependencies versions ## 6.17.1-beta.1 + - package updates and one test fix ## 6.16.1-beta.1 + - simple naming schema fix https://github.com/comigor/artemis/issues/226 ## 6.15.1-beta.1 + - Override annotation fix ## 6.14.1-beta.1 + - Package updates ## 6.13.1-beta.1 + - input underscore bugfix https://github.com/comigor/artemis/issues/223 ## 6.12.3-beta.2 + - Subscription test added ## 6.12.3-beta.1 + - Readme fix ## 6.12.2-beta.1 + - Fixed `ignore_for_file` documentation. ## 6.12.1-beta.1 + - Added `ignore_for_file` option to ignore linter rules on generated files. ## 6.11.1-beta.1 + - improved canonical types handling ## 6.10.1-beta.1 + - Package updates ## 6.9.2-beta.1 + - Fixed `toJson() doesn't remove "kw$" prefix` ## 6.8.2-beta.1 + - test fix ## 6.8.1-beta.1 + - fix for multiple schema_mapping ## 6.7.2-beta.1 + - analyzer and linter warnings fix ## 6.7.1-beta.1 + - uppercase keyword fix ## 6.6.4-beta.1 + - pubspec fix ## 6.6.3-beta.1 + - test fix ## 6.6.2-beta.1 + - nnbd preparation ## 6.6.1-beta.1 + - allow multiple operations per file ## 6.5.2-beta.1 + - performance improvements - scan schema for canonical types only once ## 6.5.1-beta.1 + - enum name pascal casing. ## 6.5.0-beta.1 + - Add deprecated annotations in fields. ## 6.4.4-beta.1 + - Build type name recursively, considering casing changes. ## 6.4.3-beta.1 + - Mass package update ## 6.3.3-beta.1 + - Centralize naming transformations; make types PascalCase and fields camelCase. ## 6.3.2-beta.1 + - Recursively consider input lists. ## 6.3.1-beta.1 + - Do not throw on unused scalars. ## 6.3.0-beta.1 + **MAJOR BREAKING CHANGE** - all starting underscores are replaced with $ @@ -295,9 +337,11 @@ - fields similar to Dart keywords are prefixed with `kw$` ## 6.2.1-beta.1 + - Check for more error causes and throw, explaining the error. ## 6.2.0-beta.1 + **MAJOR BREAKING CHANGE** We've found a regression on `6.1.0-beta.1`, which sends Enums as camelCase to @@ -306,80 +350,101 @@ the server, when they should be sent as SCREAMING_SNAKE_CASE. - Reverts `6.1.0-beta.1`. ## 6.1.1-beta.2 + - Improve actions and check pipeline output. ## 6.1.1-beta.1 + - Short-circuit input object generation on recursive detection ## 6.1.0-beta.1 + **MAJOR BREAKING CHANGE** - Convert enum casing to camel case. ## 6.0.11-beta.1 + - Convert `ClassProperty` annotation item to `List`. ## 6.0.10-beta.1 + - Duplication bug fix ## 6.0.9-beta.1 + - Added the exception for the case when `fragment_glob` leads to query files fragments ignore. ## 6.0.8-beta.1 + - Adapt Artemis to subscriptions and create an example ## 6.0.7-beta.1 + - Fix for the interfaces which uses fragments from fragments_glob ## 6.0.6-beta.1 + - Hide build logs under `--verbose` flag ## 6.0.5-beta.1 + - Include coercers annotations on custom scalars on input objects. ## 6.0.4-beta.1 + - Properly consider "sub-fragments" on class generation. ## 6.0.3-beta.1 + - Fix generation of custom scalars and its functions. ## 6.0.2-beta.1 + - Fix invalid reference to class on Query generations. ## 6.0.1-beta.1 + - End forwarder file with a newline. ## 6.0.0-beta.1 + **MAJOR BREAKING CHANGE** - Generate canonical objects (enums and input objects) with their original -names on GraphQL. Fragments are also generated with their own names (plus the `Mixin` prefix, for now). + names on GraphQL. Fragments are also generated with their own names (plus the `Mixin` prefix, for now). - Make it possible to select a naming scheme to be used for generate the class -names. `pathedWithTypes` is the default for retrocompatibility, where the names -of previous types are used as prefix of the next class. This can generate -duplication on certain schemas. With `pathedWithFields`, the names of previous -fields are used as prefix of the next class and with `simple`, only the actual -GraphQL class nameis considered. See discussion on [#90][pr-90] and [#96][pr-96] -for more information. + names. `pathedWithTypes` is the default for retrocompatibility, where the names + of previous types are used as prefix of the next class. This can generate + duplication on certain schemas. With `pathedWithFields`, the names of previous + fields are used as prefix of the next class and with `simple`, only the actual + GraphQL class nameis considered. See discussion on [#90][pr-90] and [#96][pr-96] + for more information. ## 5.1.0 + - Add `.graphql.` to outputted files path, in a non-breaking change way: a -"forwarder" file will be generated to make it retro-compatible when a -configurated output doesn't end with `.graphql.dart`. + "forwarder" file will be generated to make it retro-compatible when a + configurated output doesn't end with `.graphql.dart`. ## 5.0.4 + - Update CI to include beta branch. ## 5.0.3 + - Update examples to match latest changes. ## 5.0.2 + - Use default names for query/mutation root when SDL does not declare `schema`. ## 5.0.1 + - Fix generation of recursive input objects introduced by 5.0.0. ## 5.0.0 + **MAJOR BREAKING CHANGE** In this version we moved from `json` to `graphql` (SDL) schema parsing. @@ -393,19 +458,23 @@ If not, use this [snippet][introspection-to-sdl-snippet] [this one][introspection-to-sdl-online] to convert from one to another. ## 4.0.2 + - Only add unknownEnumValue on non-list enums - Consider all classes to include reference to meta package ## 4.0.1 + - Look at mutation root when generating a mutation ## 4.0.0 + **MAJOR BREAKING CHANGE** This version completely refactors how Artemis generate code (by finally using the implementation of visitor pattern provided by `gql`). On top of that, I've decided to do other major breaking changes to make code cleaner and more maintainable. Listed: + - `add_query_prefix` doesn't exist anymore (it's now the default to generate classes with its "path" from the query), e.g., this query's `city` field will be typed as `CityName$QueryRoot$User$Address$City`: @@ -432,11 +501,13 @@ maintainable. Listed: you're using `GraphQLQueryBuilder.onBuild`, it will break. And also: + - Add more logs and errors while generating code, to help debugging. - Add more/refactor tests. - Add a GitHub example. TODO: + - [ ] re-add more logs - [ ] clean options (?) - [ ] prefix every class with `$` (?) @@ -444,74 +515,97 @@ TODO: - [ ] review readme and changelog ## 3.2.1 + - Fix unknown enum: add prefix ## 3.2.0 + - Make enums loose. When unknown values are provided into an enum, it will fall back to a custom `ARTEMIS_UNKNOWN` value -avoiding breaking/crashing the client. + avoiding breaking/crashing the client. ## 3.1.0 + - Allow to dispose `ArtemisClient` underlining http client when possible ## 3.0.0 + - BREAKING: Marks non nullable input field as `@required` [#68][pr-68] ## 2.2.2 + - Make lists as input objects work again ## 2.2.1 + - Display error on types not found on schema ## 2.2.0+1 + - Add "Articles and videos" category on README ## 2.2.0 + - Share fragments between queries and schemas (see `fragments_glob`) [#65][pr-65] ## 2.1.4 + - Add missing prefix to generated enums ## 2.1.3 + - Bump equatable/gql suite, refine GitHub actions ## 2.1.2 + - Bump json_serializable/json_annotation ## 2.1.1 + - Properly consider Union types on generation ## 2.1.0+1 + - Fix GitHub actions deploy pipeline - Make sure artemis depends on json_annotation ## 2.1.0 + - Generate fragments as mixins ## 2.0.7+1 + - README updates ## 2.0.7 + - Add missing prefix to interfaces ## 2.0.6 + - Perserve the query name casing ## 2.0.5 + - Bump `gql` package ## 2.0.4 + - Bump `gql` package ## 2.0.3 + - Generate every field of input objects ## 2.0.2 + - Support `__schema` key under the data field or on root of `schema.json`. ## 2.0.1 + - Loosen up dependencies to make it work again with Flutter `beta` channel ## 2.0.0 + - BREAKING: move `GraphQLError` to `package:gql`. If you don't use it, or just reference it indirectly, it will not be breaking, but a major will be bumped anyway, just for sure. @@ -521,81 +615,102 @@ avoiding breaking/crashing the client. - Use `package:gql_dedupe_link` and `package:gql_http_link` as the default links ## 1.0.4 + - Add a test to guarantee query inputs can be lists ## 1.0.3 + - Disable implicit casts - Avoid double-parsing the source string ## 1.0.2 + - Differentiate lists from named types when looping through variables - Consider nullable operation name when defining query name ## 1.0.1 + - Upgrade `gql` to version `0.2.0` to get rid of direct dependency on `source_span` and for better parsing errors. - Filter for `SchemaMap` with `output` when generating code ## 1.0.0 + - Breaking: Add required `output` option to `SchemaMap` - Make Artemis a `$lib$` synthetic generator - Add `add_query_prefix` option to `SchemaMap` ## 0.7.0 + - Make generated classes a mixin of `Equatable`, meaning they can be easily comparable with `==` ## 0.6.1 + - Include pubspec.lock files of examples ## 0.6.0 + - Replace `graphql_parser` with `gql` package ## 0.5.1 + - Add most documentation - Increase pana grade (health and maintenance) - Fix some stuff related to importing http on client ## 0.5.0 + - Start using `code_builder` to better generate Dart code ## 0.4.0 + - Allow scalar mappings to include imports for types ## 0.3.2 + - Decode HTTP response as UTF-8 on execute helper. ## 0.3.1 + - Export common used files on default package route (`package:artemis/artemis.dart`) - Use single schemaMap globbing stream to make sure only one schema will be found - Add missing changelog - Test new github actions ## 0.3.0 BREAKING + - Add new generators to GraphQLQuery and QueryArguments - Fix toJson() on JsonSerializable classes (for nested entities) - [BREAKING] Remove the `execute*` functions generations, to use instead the generic `ArtemisClient` class -that should receive a GraphQLQuery generated subclass. + that should receive a GraphQLQuery generated subclass. ## 0.2.1 + Set HTTP headers only when using default HTTP client. ## 0.2.0 BREAKING + Completely overhaul how this works. -Artemis won't generate a full schema typing anymore. Instead, it will use the schema to generate typings from a specific query or mutation. It will also create helper functions to execute those queries. See [README][readme] for more info. +Artemis won't generate a full schema typing anymore. Instead, it will use the schema to generate typings from a specific +query or mutation. It will also create helper functions to execute those queries. See [README][readme] for more info. This is totally a breaking change but as this library is still on alpha, I should keep it under 1.0. ## 0.1.3 + - Make objects that implement interfaces override resolveType ## 0.1.2 + - Improve package score ## 0.1.1 + - Enable tests on pipeline ## 0.1.0 + - "Fix" json_serializable dependency - Add tests - Generate union types as inheritance @@ -603,6 +718,7 @@ This is totally a breaking change but as this library is still on alpha, I shoul - Make generated code choose inheritance ## 0.0.1 + - First release - No tests - No documentation @@ -613,10 +729,17 @@ This is totally a breaking change but as this library is still on alpha, I shoul - Lot of bugs [readme]: ./README.md + [pr-65]: https://github.com/comigor/artemis/pull/65 + [pr-68]: https://github.com/comigor/artemis/pull/68 + [apollo-3-ways-schema]: https://blog.apollographql.com/three-ways-to-represent-your-graphql-schema-a41f4175100d#:~:text=Introspection%20query%20result%20to%20SDL + [introspection-to-sdl-snippet]: https://gist.github.com/stubailo/041999ba5b8b15cede60b93ff9a38f53 + [introspection-to-sdl-online]: https://codesandbox.io/s/graphql-introspection-sdl-svlx2 + [pr-90]: https://github.com/comigor/artemis/pull/90 + [pr-96]: https://github.com/comigor/artemis/pull/96 diff --git a/example/graphbrainz/lib/queries/ed_sheeran.query.graphql.dart b/example/graphbrainz/lib/queries/ed_sheeran.query.graphql.dart index 2122c89f..296b05f1 100644 --- a/example/graphbrainz/lib/queries/ed_sheeran.query.graphql.dart +++ b/example/graphbrainz/lib/queries/ed_sheeran.query.graphql.dart @@ -164,6 +164,7 @@ enum ReleaseStatus { @JsonValue('ARTEMIS_UNKNOWN') artemisUnknown, } + final ED_SHEERAN_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( type: OperationType.query, diff --git a/lib/generator/ephemeral_data.dart b/lib/generator/ephemeral_data.dart index d1964eba..ad76507d 100644 --- a/lib/generator/ephemeral_data.dart +++ b/lib/generator/ephemeral_data.dart @@ -2,6 +2,7 @@ import 'package:artemis/generator/data/data.dart'; import 'package:artemis/generator/data/nullable.dart'; import 'package:artemis/visitor/type_definition_node_visitor.dart'; import 'package:gql/ast.dart'; + import '../schema/options.dart'; /// Returns the full class name with joined path. diff --git a/lib/generator/print_helpers.dart b/lib/generator/print_helpers.dart index 168d06ea..b23161be 100644 --- a/lib/generator/print_helpers.dart +++ b/lib/generator/print_helpers.dart @@ -439,7 +439,6 @@ void writeLibraryDefinitionToBuffer( LibraryDefinition definition, ) { buffer.writeln('// GENERATED CODE - DO NOT MODIFY BY HAND'); - buffer.writeln('// @dart = 2.12'); if (ignoreForFile.isNotEmpty) { buffer.writeln( '// ignore_for_file: ${Set.from(ignoreForFile).join(', ')}', diff --git a/pubspec.yaml b/pubspec.yaml index b5081300..1948a377 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,19 +1,19 @@ name: artemis -version: 7.9.0-beta +version: 7.10.0-beta description: Build dart types from GraphQL schemas and queries (using Introspection Query). homepage: https://github.com/comigor/artemis environment: - sdk: ">=2.14.0 <3.0.0" + sdk: ">=2.18.0 <3.0.0" dependencies: - build_config: ^1.0.0 - code_builder: ^4.1.0 - build: ^2.3.0 - collection: ^1.16.0 - dart_style: ^2.2.3 - equatable: ^2.0.3 + build_config: ^1.1.0 + code_builder: ^4.3.0 + build: ^2.3.1 + collection: ^1.17.0 + dart_style: ^2.2.4 + equatable: ^2.0.5 glob: ^2.0.2 gql_code_builder: ^0.5.1 gql_dedupe_link: ^2.0.3-alpha @@ -21,19 +21,19 @@ dependencies: gql_http_link: ^0.4.3-alpha gql_link: ^0.4.3-alpha gql: ^0.13.1 - http: ^0.13.4 - json_annotation: ^4.5.0 + http: ^0.13.5 + json_annotation: ^4.7.0 path: ^1.8.1 - recase: ^4.0.0 - source_gen: ^1.2.2 + recase: ^4.1.0 + source_gen: ^1.2.6 yaml: ^3.1.1 dev_dependencies: args: ^2.3.1 - build_runner: ^2.1.10 + build_runner: ^2.3.0 build_test: ^2.1.5 - json_serializable: ^6.2.0 - build_resolvers: ^2.0.8 - test: ^1.21.1 - logging: ^1.0.2 - lints: ^1.0.1 + json_serializable: ^6.5.1 + build_resolvers: ^2.0.10 + test: ^1.21.6 + logging: ^1.1.0 + lints: ^2.0.0 diff --git a/test/generator/print_helpers_test.dart b/test/generator/print_helpers_test.dart index dcf8c09e..8df84961 100644 --- a/test/generator/print_helpers_test.dart +++ b/test/generator/print_helpers_test.dart @@ -356,7 +356,10 @@ class AClass extends JsonSerializable with EquatableMixin, FragmentMixin { expect(str, '''@JsonSerializable(explicitToJson: true) class AClass extends JsonSerializable with EquatableMixin { - AClass({this.name, required this.anotherName}); + AClass({ + this.name, + required this.anotherName, + }); factory AClass.fromJson(Map json) => _\$AClassFromJson(json); @@ -420,7 +423,6 @@ class AClass extends JsonSerializable with EquatableMixin { writeLibraryDefinitionToBuffer(buffer, ignoreForFile, definition); expect(buffer.toString(), '''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -438,7 +440,6 @@ part 'test_query.graphql.g.dart'; writeLibraryDefinitionToBuffer(buffer, ignoreForFile, definition); expect(buffer.toString(), '''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -466,7 +467,6 @@ part 'test_query.graphql.g.dart'; writeLibraryDefinitionToBuffer(buffer, ignoreForFile, definition); expect(buffer.toString(), '''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -477,11 +477,12 @@ part 'test_query.graphql.g.dart'; final TEST_QUERY_QUERY_DOCUMENT_OPERATION_NAME = 'test_query'; final TEST_QUERY_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'test_query'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [])) + type: OperationType.query, + name: NameNode(value: 'test_query'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: []), + ) ]); class TestQueryQuery extends GraphQLQuery { @@ -522,7 +523,6 @@ class TestQueryQuery extends GraphQLQuery { writeLibraryDefinitionToBuffer(buffer, ignoreForFile, definition); expect(buffer.toString(), '''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -532,11 +532,12 @@ part 'test_query.graphql.g.dart'; final TEST_QUERY_QUERY_DOCUMENT_OPERATION_NAME = 'test_query'; final TEST_QUERY_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'test_query'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [])) + type: OperationType.query, + name: NameNode(value: 'test_query'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: []), + ) ]); '''); }); @@ -562,7 +563,6 @@ final TEST_QUERY_QUERY_DOCUMENT = DocumentNode(definitions: [ writeLibraryDefinitionToBuffer(buffer, ignoreForFile, definition); expect(buffer.toString(), r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -589,11 +589,12 @@ class TestQueryArguments extends JsonSerializable with EquatableMixin { final TEST_QUERY_QUERY_DOCUMENT_OPERATION_NAME = 'test_query'; final TEST_QUERY_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'test_query'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [])) + type: OperationType.query, + name: NameNode(value: 'test_query'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: []), + ) ]); class TestQueryQuery extends GraphQLQuery { @@ -668,11 +669,12 @@ class TestQueryArguments extends JsonSerializable with EquatableMixin { r'''final TEST_QUERY_QUERY_DOCUMENT_OPERATION_NAME = 'test_query'; final TEST_QUERY_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'test_query'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [])) + type: OperationType.query, + name: NameNode(value: 'test_query'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: []), + ) ]); class TestQueryQuery extends GraphQLQuery { TestQueryQuery({required this.variables}); @@ -717,7 +719,6 @@ class TestQueryQuery extends GraphQLQuery { writeLibraryDefinitionToBuffer(buffer, ignoreForFile, definition); expect(buffer.toString(), '''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -752,7 +753,6 @@ enum SomeEnum { writeLibraryDefinitionToBuffer(buffer, ignoreForFile, definition); expect(buffer.toString(), '''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -769,7 +769,6 @@ part 'test_query.graphql.g.dart'; writeLibraryDefinitionToBuffer(buffer, ignoreForFile, definition); expect(buffer.toString(), '''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -787,7 +786,6 @@ part 'test_query.graphql.g.dart'; writeLibraryDefinitionToBuffer(buffer, ignoreForFile, definition); expect(buffer.toString(), '''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 // ignore_for_file: my_rule_1, my_rule_2 import 'package:json_annotation/json_annotation.dart'; diff --git a/test/query_generator/aliases/alias_on_leaves_test.dart b/test/query_generator/aliases/alias_on_leaves_test.dart index c37b7203..4dc975e2 100644 --- a/test/query_generator/aliases/alias_on_leaves_test.dart +++ b/test/query_generator/aliases/alias_on_leaves_test.dart @@ -92,7 +92,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/aliases/alias_on_object_test.dart b/test/query_generator/aliases/alias_on_object_test.dart index 4ba99fd3..3f0d8007 100644 --- a/test/query_generator/aliases/alias_on_object_test.dart +++ b/test/query_generator/aliases/alias_on_object_test.dart @@ -100,7 +100,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/append_type_name_test.dart b/test/query_generator/append_type_name_test.dart index c93741b6..f0f2a79c 100644 --- a/test/query_generator/append_type_name_test.dart +++ b/test/query_generator/append_type_name_test.dart @@ -73,7 +73,6 @@ void main() { suffix: r'Query') ]), generatedFile: r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -188,7 +187,6 @@ class Custom$QueryRoot extends JsonSerializable with EquatableMixin { suffix: r'Query') ]), generatedFile: r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -315,7 +313,6 @@ class Custom$QueryRoot extends JsonSerializable with EquatableMixin { suffix: r'Query') ]), generatedFile: r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -479,7 +476,6 @@ class Custom$QueryRoot extends JsonSerializable with EquatableMixin { suffix: r'Query') ]), generatedFile: r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -655,7 +651,6 @@ class Custom$QueryRoot extends JsonSerializable with EquatableMixin { suffix: r'Query') ]), generatedFile: r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -707,53 +702,64 @@ class Custom$QueryRoot extends JsonSerializable with EquatableMixin { final CUSTOM_QUERY_DOCUMENT_OPERATION_NAME = 'custom'; final CUSTOM_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'custom'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'q'), - alias: null, - arguments: [], + type: OperationType.query, + name: NameNode(value: 'custom'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'q'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'QueryResponse'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'QueryResponse'), directives: []), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])), - FieldNode( + ), + FieldNode( name: NameNode(value: '__typename'), alias: null, arguments: [], directives: [], - selectionSet: null) - ])), + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), FragmentDefinitionNode( + name: NameNode(value: 'QueryResponse'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( name: NameNode(value: 'QueryResponse'), - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'QueryResponse'), isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'e'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: '__typename'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) + isNonNull: false, + )), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'e'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), ]); class CustomQuery extends GraphQLQuery { diff --git a/test/query_generator/ast_schema/field_not_found_mutation_test.dart b/test/query_generator/ast_schema/field_not_found_mutation_test.dart index a52a48de..18d70d69 100644 --- a/test/query_generator/ast_schema/field_not_found_mutation_test.dart +++ b/test/query_generator/ast_schema/field_not_found_mutation_test.dart @@ -124,7 +124,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -186,7 +185,10 @@ class CreateThing$MutationRoot extends JsonSerializable with EquatableMixin { @JsonSerializable(explicitToJson: true) class CreateThingInput extends JsonSerializable with EquatableMixin { - CreateThingInput({required this.clientId, this.message}); + CreateThingInput({ + required this.clientId, + this.message, + }); factory CreateThingInput.fromJson(Map json) => _$CreateThingInputFromJson(json); diff --git a/test/query_generator/ast_schema/input_types_test.dart b/test/query_generator/ast_schema/input_types_test.dart index 9595aa02..02faec65 100644 --- a/test/query_generator/ast_schema/input_types_test.dart +++ b/test/query_generator/ast_schema/input_types_test.dart @@ -147,7 +147,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -209,7 +208,11 @@ class CreateThing$MutationRoot extends JsonSerializable with EquatableMixin { @JsonSerializable(explicitToJson: true) class CreateThingInput extends JsonSerializable with EquatableMixin { - CreateThingInput({required this.clientId, this.message, this.shares}); + CreateThingInput({ + required this.clientId, + this.message, + this.shares, + }); factory CreateThingInput.fromJson(Map json) => _$CreateThingInputFromJson(json); diff --git a/test/query_generator/ast_schema/missing_schema_test.dart b/test/query_generator/ast_schema/missing_schema_test.dart index 95cc8123..cf0d8fcd 100644 --- a/test/query_generator/ast_schema/missing_schema_test.dart +++ b/test/query_generator/ast_schema/missing_schema_test.dart @@ -50,7 +50,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/ast_schema/multiple_schema_mappint_test.dart b/test/query_generator/ast_schema/multiple_schema_mappint_test.dart index 92bb4a5c..db0e0399 100644 --- a/test/query_generator/ast_schema/multiple_schema_mappint_test.dart +++ b/test/query_generator/ast_schema/multiple_schema_mappint_test.dart @@ -1,7 +1,7 @@ import 'package:artemis/builder.dart'; -import 'package:build/build.dart'; import 'package:artemis/generator/data/data.dart'; import 'package:artemis/generator/data/enum_value_definition.dart'; +import 'package:build/build.dart'; import 'package:build_test/build_test.dart'; import 'package:test/test.dart'; @@ -293,7 +293,6 @@ final libraryDefinitionB = ]); const generatedFileA = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -349,37 +348,42 @@ enum ArticleType { final BROWSE_ARTICLES_QUERY_DOCUMENT_OPERATION_NAME = 'BrowseArticles'; final BROWSE_ARTICLES_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'BrowseArticles'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'articles'), + type: OperationType.query, + name: NameNode(value: 'BrowseArticles'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'articles'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'id'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'title'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'articleType'), alias: null, arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'id'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'title'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'articleType'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ), + ]), + ) + ]), + ) ]); class BrowseArticlesQuery @@ -401,7 +405,6 @@ class BrowseArticlesQuery '''; const generatedFileB = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -452,7 +455,10 @@ class BrowseRepositories$Query extends JsonSerializable with EquatableMixin { @JsonSerializable(explicitToJson: true) class NotificationOptionInput extends JsonSerializable with EquatableMixin { - NotificationOptionInput({this.type, this.enabled}); + NotificationOptionInput({ + this.type, + this.enabled, + }); factory NotificationOptionInput.fromJson(Map json) => _$NotificationOptionInputFromJson(json); @@ -518,58 +524,67 @@ class BrowseRepositoriesArguments extends JsonSerializable with EquatableMixin { final BROWSE_REPOSITORIES_QUERY_DOCUMENT_OPERATION_NAME = 'BrowseRepositories'; final BROWSE_REPOSITORIES_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'BrowseRepositories'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'notificationTypes')), - type: ListTypeNode( - type: NamedTypeNode( - name: NameNode(value: 'NotificationOptionInput'), - isNonNull: false), - isNonNull: false), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'repositories'), + type: OperationType.query, + name: NameNode(value: 'BrowseRepositories'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'notificationTypes')), + type: ListTypeNode( + type: NamedTypeNode( + name: NameNode(value: 'NotificationOptionInput'), + isNonNull: false, + ), + isNonNull: false, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'repositories'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'notificationTypes'), + value: VariableNode(name: NameNode(value: 'notificationTypes')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'id'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'notificationTypes'), - value: - VariableNode(name: NameNode(value: 'notificationTypes'))) - ], + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'title'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'privacy'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'status'), + alias: null, + arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'id'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'title'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'privacy'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'status'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ), + ]), + ) + ]), + ) ]); class BrowseRepositoriesQuery extends GraphQLQuery json) => _$InputFromJson(json); @@ -176,36 +178,43 @@ class CustomArguments extends JsonSerializable with EquatableMixin { final CUSTOM_MUTATION_DOCUMENT_OPERATION_NAME = 'custom'; final CUSTOM_MUTATION_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'custom'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'input')), - type: - NamedTypeNode(name: NameNode(value: 'Input'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'mut'), + type: OperationType.mutation, + name: NameNode(value: 'custom'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'input')), + type: NamedTypeNode( + name: NameNode(value: 'Input'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'mut'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'input'), + value: VariableNode(name: NameNode(value: 'input')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 's'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'input'), - value: VariableNode(name: NameNode(value: 'input'))) - ], + arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 's'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ) + ]), + ) + ]), + ) ]); class CustomMutation diff --git a/test/query_generator/deprecated/deprecated_interface_field_test.dart b/test/query_generator/deprecated/deprecated_interface_field_test.dart index 36c11f3c..bcb66fbe 100644 --- a/test/query_generator/deprecated/deprecated_interface_field_test.dart +++ b/test/query_generator/deprecated/deprecated_interface_field_test.dart @@ -164,7 +164,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/enums/enum_duplication_test.dart b/test/query_generator/enums/enum_duplication_test.dart index 9da091be..d7de230b 100644 --- a/test/query_generator/enums/enum_duplication_test.dart +++ b/test/query_generator/enums/enum_duplication_test.dart @@ -137,7 +137,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/enums/enum_list_test.dart b/test/query_generator/enums/enum_list_test.dart index f5232b36..98772a60 100644 --- a/test/query_generator/enums/enum_list_test.dart +++ b/test/query_generator/enums/enum_list_test.dart @@ -85,7 +85,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/enums/filter_enum_test.dart b/test/query_generator/enums/filter_enum_test.dart index 82873461..9e7f0794 100644 --- a/test/query_generator/enums/filter_enum_test.dart +++ b/test/query_generator/enums/filter_enum_test.dart @@ -151,7 +151,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/enums/input_enum_list_test.dart b/test/query_generator/enums/input_enum_list_test.dart index 44244357..54fdf4cd 100644 --- a/test/query_generator/enums/input_enum_list_test.dart +++ b/test/query_generator/enums/input_enum_list_test.dart @@ -112,7 +112,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -185,50 +184,60 @@ class BrowseArticlesArguments extends JsonSerializable with EquatableMixin { final BROWSE_ARTICLES_QUERY_DOCUMENT_OPERATION_NAME = 'BrowseArticles'; final BROWSE_ARTICLES_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'BrowseArticles'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'article_type_in')), - type: ListTypeNode( - type: NamedTypeNode( - name: NameNode(value: 'ArticleType'), isNonNull: true), - isNonNull: false), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'articles'), + type: OperationType.query, + name: NameNode(value: 'BrowseArticles'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'article_type_in')), + type: ListTypeNode( + type: NamedTypeNode( + name: NameNode(value: 'ArticleType'), + isNonNull: true, + ), + isNonNull: false, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'articles'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'article_type_in'), + value: VariableNode(name: NameNode(value: 'article_type_in')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'id'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'article_type_in'), - value: VariableNode(name: NameNode(value: 'article_type_in'))) - ], + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'title'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'article_type'), + alias: null, + arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'id'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'title'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'article_type'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ), + ]), + ) + ]), + ) ]); class BrowseArticlesQuery diff --git a/test/query_generator/enums/input_enum_test.dart b/test/query_generator/enums/input_enum_test.dart index e3f36610..ee4c00b2 100644 --- a/test/query_generator/enums/input_enum_test.dart +++ b/test/query_generator/enums/input_enum_test.dart @@ -144,7 +144,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -224,7 +223,11 @@ enum OtherEnum { @JsonSerializable(explicitToJson: true) class CustomArguments extends JsonSerializable with EquatableMixin { - CustomArguments({required this.$id, required this.input, required this.o}); + CustomArguments({ + required this.$id, + required this.input, + required this.o, + }); @override factory CustomArguments.fromJson(Map json) => @@ -247,65 +250,83 @@ class CustomArguments extends JsonSerializable with EquatableMixin { final CUSTOM_QUERY_DOCUMENT_OPERATION_NAME = 'custom'; final CUSTOM_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'custom'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: '_id')), - type: NamedTypeNode(name: NameNode(value: 'ID'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []), - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'input')), - type: - NamedTypeNode(name: NameNode(value: 'Input'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []), - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'o')), - type: NamedTypeNode( - name: NameNode(value: 'OtherEnum'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'q'), + type: OperationType.query, + name: NameNode(value: 'custom'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: '_id')), + type: NamedTypeNode( + name: NameNode(value: 'ID'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'input')), + type: NamedTypeNode( + name: NameNode(value: 'Input'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'o')), + type: NamedTypeNode( + name: NameNode(value: 'OtherEnum'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'q'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: '_id'), + value: VariableNode(name: NameNode(value: '_id')), + ), + ArgumentNode( + name: NameNode(value: 'input'), + value: VariableNode(name: NameNode(value: 'input')), + ), + ArgumentNode( + name: NameNode(value: 'o'), + value: VariableNode(name: NameNode(value: 'o')), + ), + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 's'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: '_id'), - value: VariableNode(name: NameNode(value: '_id'))), - ArgumentNode( - name: NameNode(value: 'input'), - value: VariableNode(name: NameNode(value: 'input'))), - ArgumentNode( - name: NameNode(value: 'o'), - value: VariableNode(name: NameNode(value: 'o'))) - ], + arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 's'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'my'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'other'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'my'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'other'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ) + ]), + ) ]); class CustomQuery extends GraphQLQuery { diff --git a/test/query_generator/enums/kw_prefix_test.dart b/test/query_generator/enums/kw_prefix_test.dart index 83397833..f26ae11c 100644 --- a/test/query_generator/enums/kw_prefix_test.dart +++ b/test/query_generator/enums/kw_prefix_test.dart @@ -116,7 +116,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -158,7 +157,10 @@ class SearchArticles$Query extends JsonSerializable with EquatableMixin { @JsonSerializable(explicitToJson: true) class ArticleTitleWhereConditions extends JsonSerializable with EquatableMixin { - ArticleTitleWhereConditions({this.kw$operator, this.value}); + ArticleTitleWhereConditions({ + this.kw$operator, + this.value, + }); factory ArticleTitleWhereConditions.fromJson(Map json) => _$ArticleTitleWhereConditionsFromJson(json); diff --git a/test/query_generator/enums/query_enum_test.dart b/test/query_generator/enums/query_enum_test.dart index 7c05b22e..72481838 100644 --- a/test/query_generator/enums/query_enum_test.dart +++ b/test/query_generator/enums/query_enum_test.dart @@ -87,7 +87,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/forwarder_test.dart b/test/query_generator/forwarder_test.dart index 268e87ec..8fe73bfe 100644 --- a/test/query_generator/forwarder_test.dart +++ b/test/query_generator/forwarder_test.dart @@ -68,7 +68,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/fragments/fragment_duplication_test.dart b/test/query_generator/fragments/fragment_duplication_test.dart index 7b17476b..2303aec7 100644 --- a/test/query_generator/fragments/fragment_duplication_test.dart +++ b/test/query_generator/fragments/fragment_duplication_test.dart @@ -212,7 +212,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/fragments/fragment_glob_schema_level_test.dart b/test/query_generator/fragments/fragment_glob_schema_level_test.dart index 912aa2eb..a51d5b20 100644 --- a/test/query_generator/fragments/fragment_glob_schema_level_test.dart +++ b/test/query_generator/fragments/fragment_glob_schema_level_test.dart @@ -203,7 +203,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -316,110 +315,146 @@ class PokemonAttackMixin$Attack extends JsonSerializable final QUERY_QUERY_DOCUMENT_OPERATION_NAME = 'query'; final QUERY_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: null, - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'pokemon'), + 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: [ - ArgumentNode( - name: NameNode(value: 'name'), - value: StringValueNode(value: 'Pikachu', isBlock: false)) - ], + arguments: [], 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: []) - ])) - ])) - ])), + name: NameNode(value: 'Pokemon'), + directives: [], + ) + ]), + ), + ]), + ) + ]), + ), FragmentDefinitionNode( + name: NameNode(value: 'Pokemon'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( 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( + 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'), - alias: null, - arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'weight'), directives: []) - ])), - FieldNode( - name: NameNode(value: 'attacks'), - alias: null, - arguments: [], + ) + ]), + ), + FieldNode( + name: NameNode(value: 'attacks'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'pokemonAttack'), 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) - ])), + 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: [], + 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: [], - 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) - ])) + 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 QueryQuery extends GraphQLQuery { diff --git a/test/query_generator/fragments/fragment_glob_test.dart b/test/query_generator/fragments/fragment_glob_test.dart index 67aa66c4..83882c53 100644 --- a/test/query_generator/fragments/fragment_glob_test.dart +++ b/test/query_generator/fragments/fragment_glob_test.dart @@ -188,7 +188,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -301,110 +300,146 @@ class PokemonAttackMixin$Attack extends JsonSerializable final QUERY_QUERY_DOCUMENT_OPERATION_NAME = 'query'; final QUERY_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: null, - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'pokemon'), + 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: [ - ArgumentNode( - name: NameNode(value: 'name'), - value: StringValueNode(value: 'Pikachu', isBlock: false)) - ], + arguments: [], 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: []) - ])) - ])) - ])), + name: NameNode(value: 'Pokemon'), + directives: [], + ) + ]), + ), + ]), + ) + ]), + ), FragmentDefinitionNode( + name: NameNode(value: 'Pokemon'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( 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( + 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'), - alias: null, - arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'weight'), directives: []) - ])), - FieldNode( - name: NameNode(value: 'attacks'), - alias: null, - arguments: [], + ) + ]), + ), + FieldNode( + name: NameNode(value: 'attacks'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'pokemonAttack'), 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) - ])), + 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: [], + 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: [], - 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) - ])) + 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 QueryQuery extends GraphQLQuery { diff --git a/test/query_generator/fragments/fragment_multiple_queries_test.dart b/test/query_generator/fragments/fragment_multiple_queries_test.dart index 38f6fa0b..a81f1297 100644 --- a/test/query_generator/fragments/fragment_multiple_queries_test.dart +++ b/test/query_generator/fragments/fragment_multiple_queries_test.dart @@ -179,7 +179,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -269,52 +268,65 @@ class GetPokemonArguments extends JsonSerializable with EquatableMixin { final GET_POKEMON_QUERY_DOCUMENT_OPERATION_NAME = 'getPokemon'; final GET_POKEMON_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'getPokemon'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'name')), - type: - NamedTypeNode(name: NameNode(value: 'String'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'pokemon'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'name'), - value: VariableNode(name: NameNode(value: 'name'))) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'pokemonFragment'), directives: []) - ])) - ])), - FragmentDefinitionNode( - name: NameNode(value: 'pokemonFragment'), - 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( + type: OperationType.query, + name: NameNode(value: 'getPokemon'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'name')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'pokemon'), + alias: null, + arguments: [ + ArgumentNode( name: NameNode(value: 'name'), - alias: null, - arguments: [], + value: VariableNode(name: NameNode(value: 'name')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'pokemonFragment'), directives: [], - selectionSet: null) - ])) + ) + ]), + ) + ]), + ), + FragmentDefinitionNode( + name: NameNode(value: 'pokemonFragment'), + 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, + ), + ]), + ), ]); class GetPokemonQuery @@ -356,51 +368,65 @@ class GetAllPokemonsArguments extends JsonSerializable with EquatableMixin { final GET_ALL_POKEMONS_QUERY_DOCUMENT_OPERATION_NAME = 'getAllPokemons'; final GET_ALL_POKEMONS_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'getAllPokemons'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'first')), - type: NamedTypeNode(name: NameNode(value: 'Int'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'pokemons'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'first'), - value: VariableNode(name: NameNode(value: 'first'))) - ], + type: OperationType.query, + name: NameNode(value: 'getAllPokemons'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'first')), + type: NamedTypeNode( + name: NameNode(value: 'Int'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'pokemons'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'first'), + value: VariableNode(name: NameNode(value: 'first')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'pokemonFragment'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'pokemonFragment'), directives: []) - ])) - ])), + ) + ]), + ) + ]), + ), FragmentDefinitionNode( - name: NameNode(value: 'pokemonFragment'), - 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) - ])) + name: NameNode(value: 'pokemonFragment'), + 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, + ), + ]), + ), ]); class GetAllPokemonsQuery diff --git a/test/query_generator/fragments/fragment_on_fragments_test.dart b/test/query_generator/fragments/fragment_on_fragments_test.dart index 15bbe7d8..0f2395b9 100644 --- a/test/query_generator/fragments/fragment_on_fragments_test.dart +++ b/test/query_generator/fragments/fragment_on_fragments_test.dart @@ -131,7 +131,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/fragments/fragments_multiple_test.dart b/test/query_generator/fragments/fragments_multiple_test.dart index 43a35d4e..018416f8 100644 --- a/test/query_generator/fragments/fragments_multiple_test.dart +++ b/test/query_generator/fragments/fragments_multiple_test.dart @@ -244,7 +244,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -373,7 +372,10 @@ class VoyagesData$Query extends JsonSerializable with EquatableMixin { @JsonSerializable(explicitToJson: true) class PaginationInput extends JsonSerializable with EquatableMixin { - PaginationInput({required this.limit, required this.offset}); + PaginationInput({ + required this.limit, + required this.offset, + }); factory PaginationInput.fromJson(Map json) => _$PaginationInputFromJson(json); @@ -407,128 +409,154 @@ class VoyagesDataArguments extends JsonSerializable with EquatableMixin { final VOYAGES_DATA_QUERY_DOCUMENT_OPERATION_NAME = 'VoyagesData'; final VOYAGES_DATA_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'VoyagesData'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'input')), - type: NamedTypeNode( - name: NameNode(value: 'PaginationInput'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( + type: OperationType.query, + name: NameNode(value: 'VoyagesData'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'input')), + type: NamedTypeNode( + name: NameNode(value: 'PaginationInput'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'voyages'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'pagination'), + value: VariableNode(name: NameNode(value: 'input')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( name: NameNode(value: 'voyages'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'pagination'), - value: VariableNode(name: NameNode(value: 'input'))) - ], + arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FieldNode( - name: NameNode(value: 'voyages'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'numberOfReports'), - alias: null, - arguments: [], + name: NameNode(value: 'numberOfReports'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'voyage'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'dateFrom'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'dateTo'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'id'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'voyageNumber'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'arrival'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'Dst'), directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'voyage'), - alias: null, - arguments: [], + ) + ]), + ), + FieldNode( + name: NameNode(value: 'departure'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'Departure'), directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'dateFrom'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'dateTo'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'id'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'voyageNumber'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'arrival'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'Dst'), - directives: []) - ])), - FieldNode( - name: NameNode(value: 'departure'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FragmentSpreadNode( - name: NameNode(value: 'Departure'), - directives: []) - ])) - ])) - ])) - ])) - ])), + ) + ]), + ), + ]), + ), + ]), + ) + ]), + ) + ]), + ), FragmentDefinitionNode( - name: NameNode(value: 'Dst'), - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'Destination'), isNonNull: false)), - 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) - ])), + name: NameNode(value: 'Dst'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'Destination'), + isNonNull: false, + )), + 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, + ), + ]), + ), FragmentDefinitionNode( - name: NameNode(value: 'Departure'), - typeCondition: TypeConditionNode( - on: NamedTypeNode( - name: NameNode(value: 'Destination'), isNonNull: false)), - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'id'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) + name: NameNode(value: 'Departure'), + typeCondition: TypeConditionNode( + on: NamedTypeNode( + name: NameNode(value: 'Destination'), + isNonNull: false, + )), + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'id'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ) + ]), + ), ]); class VoyagesDataQuery diff --git a/test/query_generator/fragments/fragments_test.dart b/test/query_generator/fragments/fragments_test.dart index efb63cc7..ef3d2387 100644 --- a/test/query_generator/fragments/fragments_test.dart +++ b/test/query_generator/fragments/fragments_test.dart @@ -64,7 +64,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/fragments/multiple_references_on_simple_naming_test.dart b/test/query_generator/fragments/multiple_references_on_simple_naming_test.dart index 04ff1f74..ab7c7fb5 100644 --- a/test/query_generator/fragments/multiple_references_on_simple_naming_test.dart +++ b/test/query_generator/fragments/multiple_references_on_simple_naming_test.dart @@ -118,7 +118,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/interfaces/interface_fragment_glob_test.dart b/test/query_generator/interfaces/interface_fragment_glob_test.dart index 7ac98635..95b39979 100644 --- a/test/query_generator/interfaces/interface_fragment_glob_test.dart +++ b/test/query_generator/interfaces/interface_fragment_glob_test.dart @@ -169,7 +169,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/interfaces/interface_possible_types_test.dart b/test/query_generator/interfaces/interface_possible_types_test.dart index b34e0499..72e487ae 100644 --- a/test/query_generator/interfaces/interface_possible_types_test.dart +++ b/test/query_generator/interfaces/interface_possible_types_test.dart @@ -138,7 +138,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/interfaces/interface_test.dart b/test/query_generator/interfaces/interface_test.dart index f34a283f..7d459f2b 100644 --- a/test/query_generator/interfaces/interface_test.dart +++ b/test/query_generator/interfaces/interface_test.dart @@ -160,7 +160,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/multiple_operations_per_file_test.dart b/test/query_generator/multiple_operations_per_file_test.dart index 6599eae1..a9331498 100644 --- a/test/query_generator/multiple_operations_per_file_test.dart +++ b/test/query_generator/multiple_operations_per_file_test.dart @@ -158,7 +158,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -266,36 +265,43 @@ class MutDataArguments extends JsonSerializable with EquatableMixin { final MUT_DATA_MUTATION_DOCUMENT_OPERATION_NAME = 'MutData'; final MUT_DATA_MUTATION_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'MutData'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'input')), - type: - NamedTypeNode(name: NameNode(value: 'Input'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'mut'), + type: OperationType.mutation, + name: NameNode(value: 'MutData'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'input')), + type: NamedTypeNode( + name: NameNode(value: 'Input'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'mut'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'input'), + value: VariableNode(name: NameNode(value: 'input')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 's'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'input'), - value: VariableNode(name: NameNode(value: 'input'))) - ], + arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 's'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ) + ]), + ) + ]), + ) ]); class MutDataMutation extends GraphQLQuery { @@ -319,7 +325,10 @@ class MutDataMutation extends GraphQLQuery { @JsonSerializable(explicitToJson: true) class QueDataArguments extends JsonSerializable with EquatableMixin { - QueDataArguments({required this.intsNonNullable, this.stringNullable}); + QueDataArguments({ + required this.intsNonNullable, + this.stringNullable, + }); @override factory QueDataArguments.fromJson(Map json) => @@ -338,65 +347,78 @@ class QueDataArguments extends JsonSerializable with EquatableMixin { final QUE_DATA_QUERY_DOCUMENT_OPERATION_NAME = 'QueData'; final QUE_DATA_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'QueData'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'intsNonNullable')), - type: ListTypeNode( - type: NamedTypeNode( - name: NameNode(value: 'Int'), isNonNull: false), - isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []), - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'stringNullable')), - type: NamedTypeNode( - name: NameNode(value: 'String'), isNonNull: false), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'que'), + type: OperationType.query, + name: NameNode(value: 'QueData'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'intsNonNullable')), + type: ListTypeNode( + type: NamedTypeNode( + name: NameNode(value: 'Int'), + isNonNull: false, + ), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'stringNullable')), + type: NamedTypeNode( + name: NameNode(value: 'String'), + isNonNull: false, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'que'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'intsNonNullable'), + value: VariableNode(name: NameNode(value: 'intsNonNullable')), + ), + ArgumentNode( + name: NameNode(value: 'stringNullable'), + value: VariableNode(name: NameNode(value: 'stringNullable')), + ), + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 's'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'i'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'list'), alias: null, arguments: [ ArgumentNode( - name: NameNode(value: 'intsNonNullable'), - value: - VariableNode(name: NameNode(value: 'intsNonNullable'))), - ArgumentNode( - name: NameNode(value: 'stringNullable'), - value: VariableNode(name: NameNode(value: 'stringNullable'))) + name: NameNode(value: 'intsNonNullable'), + value: VariableNode(name: NameNode(value: 'intsNonNullable')), + ) ], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 's'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'i'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'list'), - alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'intsNonNullable'), - value: VariableNode( - name: NameNode(value: 'intsNonNullable'))) - ], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ), + ]), + ) + ]), + ) ]); class QueDataQuery extends GraphQLQuery { diff --git a/test/query_generator/multiple_queries_test.dart b/test/query_generator/multiple_queries_test.dart index 636295b5..75b4098f 100644 --- a/test/query_generator/multiple_queries_test.dart +++ b/test/query_generator/multiple_queries_test.dart @@ -74,7 +74,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/mutations_and_inputs/complex_input_objects_test.dart b/test/query_generator/mutations_and_inputs/complex_input_objects_test.dart index 196ccc8f..9d0714fd 100644 --- a/test/query_generator/mutations_and_inputs/complex_input_objects_test.dart +++ b/test/query_generator/mutations_and_inputs/complex_input_objects_test.dart @@ -124,7 +124,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -165,7 +164,12 @@ class SomeQuery$QueryRoot extends JsonSerializable with EquatableMixin { @JsonSerializable(explicitToJson: true) class ComplexInput extends JsonSerializable with EquatableMixin { - ComplexInput({required this.s, this.e, this.ls, this.i}); + ComplexInput({ + required this.s, + this.e, + this.ls, + this.i, + }); factory ComplexInput.fromJson(Map json) => _$ComplexInputFromJson(json); @@ -213,36 +217,43 @@ class SomeQueryArguments extends JsonSerializable with EquatableMixin { final SOME_QUERY_QUERY_DOCUMENT_OPERATION_NAME = 'some_query'; final SOME_QUERY_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'some_query'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'filter')), - type: NamedTypeNode( - name: NameNode(value: 'ComplexInput'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'o'), + type: OperationType.query, + name: NameNode(value: 'some_query'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'filter')), + type: NamedTypeNode( + name: NameNode(value: 'ComplexInput'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'o'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'filter'), + value: VariableNode(name: NameNode(value: 'filter')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 's'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'filter'), - value: VariableNode(name: NameNode(value: 'filter'))) - ], + arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 's'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ) + ]), + ) + ]), + ) ]); class SomeQueryQuery diff --git a/test/query_generator/mutations_and_inputs/custom_scalars_on_input_objects_test.dart b/test/query_generator/mutations_and_inputs/custom_scalars_on_input_objects_test.dart index fd6bcddf..02b02f3b 100644 --- a/test/query_generator/mutations_and_inputs/custom_scalars_on_input_objects_test.dart +++ b/test/query_generator/mutations_and_inputs/custom_scalars_on_input_objects_test.dart @@ -134,7 +134,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -179,7 +178,10 @@ class Custom$MutationRoot extends JsonSerializable with EquatableMixin { @JsonSerializable(explicitToJson: true) class Input extends JsonSerializable with EquatableMixin { - Input({required this.id, this.idNullabe}); + Input({ + required this.id, + this.idNullabe, + }); factory Input.fromJson(Map json) => _$InputFromJson(json); @@ -201,7 +203,11 @@ class Input extends JsonSerializable with EquatableMixin { @JsonSerializable(explicitToJson: true) class CustomArguments extends JsonSerializable with EquatableMixin { - CustomArguments({required this.input, this.previousId, this.listIds}); + CustomArguments({ + required this.input, + this.previousId, + this.listIds, + }); @override factory CustomArguments.fromJson(Map json) => @@ -230,56 +236,72 @@ class CustomArguments extends JsonSerializable with EquatableMixin { final CUSTOM_MUTATION_DOCUMENT_OPERATION_NAME = 'custom'; final CUSTOM_MUTATION_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'custom'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'input')), - type: - NamedTypeNode(name: NameNode(value: 'Input'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []), - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'previousId')), - type: NamedTypeNode( - name: NameNode(value: 'MyUuid'), isNonNull: false), - defaultValue: DefaultValueNode(value: null), - directives: []), - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'listIds')), - type: ListTypeNode( - type: NamedTypeNode( - name: NameNode(value: 'MyUuid'), isNonNull: false), - isNonNull: false), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'mut'), + type: OperationType.mutation, + name: NameNode(value: 'custom'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'input')), + type: NamedTypeNode( + name: NameNode(value: 'Input'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'previousId')), + type: NamedTypeNode( + name: NameNode(value: 'MyUuid'), + isNonNull: false, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'listIds')), + type: ListTypeNode( + type: NamedTypeNode( + name: NameNode(value: 'MyUuid'), + isNonNull: false, + ), + isNonNull: false, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'mut'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'input'), + value: VariableNode(name: NameNode(value: 'input')), + ), + ArgumentNode( + name: NameNode(value: 'previousId'), + value: VariableNode(name: NameNode(value: 'previousId')), + ), + ArgumentNode( + name: NameNode(value: 'listIds'), + value: VariableNode(name: NameNode(value: 'listIds')), + ), + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 's'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'input'), - value: VariableNode(name: NameNode(value: 'input'))), - ArgumentNode( - name: NameNode(value: 'previousId'), - value: VariableNode(name: NameNode(value: 'previousId'))), - ArgumentNode( - name: NameNode(value: 'listIds'), - value: VariableNode(name: NameNode(value: 'listIds'))) - ], + arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 's'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ) + ]), + ) + ]), + ) ]); class CustomMutation diff --git a/test/query_generator/mutations_and_inputs/filter_input_objects_test.dart b/test/query_generator/mutations_and_inputs/filter_input_objects_test.dart index 6b311941..b982c091 100644 --- a/test/query_generator/mutations_and_inputs/filter_input_objects_test.dart +++ b/test/query_generator/mutations_and_inputs/filter_input_objects_test.dart @@ -113,7 +113,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -200,36 +199,43 @@ class SomeQueryArguments extends JsonSerializable with EquatableMixin { final SOME_QUERY_QUERY_DOCUMENT_OPERATION_NAME = 'some_query'; final SOME_QUERY_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'some_query'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'input')), - type: - NamedTypeNode(name: NameNode(value: 'Input'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'o'), + type: OperationType.query, + name: NameNode(value: 'some_query'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'input')), + type: NamedTypeNode( + name: NameNode(value: 'Input'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'o'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'input'), + value: VariableNode(name: NameNode(value: 'input')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 's'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'input'), - value: VariableNode(name: NameNode(value: 'input'))) - ], + arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 's'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ) + ]), + ) + ]), + ) ]); class SomeQueryQuery diff --git a/test/query_generator/mutations_and_inputs/input_duplication_test.dart b/test/query_generator/mutations_and_inputs/input_duplication_test.dart index 90d2c7cc..2b19db34 100644 --- a/test/query_generator/mutations_and_inputs/input_duplication_test.dart +++ b/test/query_generator/mutations_and_inputs/input_duplication_test.dart @@ -152,7 +152,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -253,36 +252,43 @@ class CustomArguments extends JsonSerializable with EquatableMixin { final CUSTOM_MUTATION_DOCUMENT_OPERATION_NAME = 'custom'; final CUSTOM_MUTATION_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'custom'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'input')), - type: - NamedTypeNode(name: NameNode(value: 'Input'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'mut'), + type: OperationType.mutation, + name: NameNode(value: 'custom'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'input')), + type: NamedTypeNode( + name: NameNode(value: 'Input'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'mut'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'input'), + value: VariableNode(name: NameNode(value: 'input')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 's'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'input'), - value: VariableNode(name: NameNode(value: 'input'))) - ], + arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 's'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ) + ]), + ) + ]), + ) ]); class CustomMutation extends GraphQLQuery { @@ -323,38 +329,46 @@ class CustomListArguments extends JsonSerializable with EquatableMixin { final CUSTOM_LIST_MUTATION_DOCUMENT_OPERATION_NAME = 'customList'; final CUSTOM_LIST_MUTATION_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'customList'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'input')), - type: ListTypeNode( - type: NamedTypeNode( - name: NameNode(value: 'Input'), isNonNull: true), - isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'mutList'), + type: OperationType.mutation, + name: NameNode(value: 'customList'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'input')), + type: ListTypeNode( + type: NamedTypeNode( + name: NameNode(value: 'Input'), + isNonNull: true, + ), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'mutList'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'input'), + value: VariableNode(name: NameNode(value: 'input')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 's'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'input'), - value: VariableNode(name: NameNode(value: 'input'))) - ], + arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 's'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ) + ]), + ) + ]), + ) ]); class CustomListMutation diff --git a/test/query_generator/mutations_and_inputs/mutations_test.dart b/test/query_generator/mutations_and_inputs/mutations_test.dart index 26ac5232..edf60af8 100644 --- a/test/query_generator/mutations_and_inputs/mutations_test.dart +++ b/test/query_generator/mutations_and_inputs/mutations_test.dart @@ -162,7 +162,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -286,36 +285,43 @@ class CustomArguments extends JsonSerializable with EquatableMixin { final CUSTOM_MUTATION_DOCUMENT_OPERATION_NAME = 'custom'; final CUSTOM_MUTATION_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: 'custom'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'input')), - type: - NamedTypeNode(name: NameNode(value: 'Input'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'mut'), + type: OperationType.mutation, + name: NameNode(value: 'custom'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'input')), + type: NamedTypeNode( + name: NameNode(value: 'Input'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'mut'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'input'), + value: VariableNode(name: NameNode(value: 'input')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 's'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'input'), - value: VariableNode(name: NameNode(value: 'input'))) - ], + arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 's'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ) + ]), + ) + ]), + ) ]); class CustomMutation @@ -357,36 +363,43 @@ class $customArguments extends JsonSerializable with EquatableMixin { final $CUSTOM_MUTATION_DOCUMENT_OPERATION_NAME = '_custom'; final $CUSTOM_MUTATION_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.mutation, - name: NameNode(value: '_custom'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'input')), - type: - NamedTypeNode(name: NameNode(value: '_Input'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: '_mut'), + type: OperationType.mutation, + name: NameNode(value: '_custom'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'input')), + type: NamedTypeNode( + name: NameNode(value: '_Input'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: '_mut'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'input'), + value: VariableNode(name: NameNode(value: 'input')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: '_s'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'input'), - value: VariableNode(name: NameNode(value: 'input'))) - ], + arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: '_s'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ) + ]), + ) + ]), + ) ]); class $customMutation diff --git a/test/query_generator/mutations_and_inputs/non_nullable_list_inputs_test.dart b/test/query_generator/mutations_and_inputs/non_nullable_list_inputs_test.dart index 4dad7a3e..c767867c 100644 --- a/test/query_generator/mutations_and_inputs/non_nullable_list_inputs_test.dart +++ b/test/query_generator/mutations_and_inputs/non_nullable_list_inputs_test.dart @@ -103,7 +103,6 @@ void main() { suffix: r'Query') ]), generatedFile: r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -143,15 +142,16 @@ class SomeQuery$Query extends JsonSerializable with EquatableMixin { @JsonSerializable(explicitToJson: true) class SomeQueryArguments extends JsonSerializable with EquatableMixin { - SomeQueryArguments( - {this.i, - required this.inn, - this.li, - this.linn, - required this.lnni, - required this.lnninn, - this.matrix, - required this.matrixnn}); + SomeQueryArguments({ + this.i, + required this.inn, + this.li, + this.linn, + required this.lnni, + required this.lnninn, + this.matrix, + required this.matrixnn, + }); @override factory SomeQueryArguments.fromJson(Map json) => @@ -182,113 +182,158 @@ class SomeQueryArguments extends JsonSerializable with EquatableMixin { final SOME_QUERY_QUERY_DOCUMENT_OPERATION_NAME = 'some_query'; final SOME_QUERY_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'some_query'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'i')), - type: NamedTypeNode(name: NameNode(value: 'Int'), isNonNull: false), - defaultValue: DefaultValueNode(value: null), - directives: []), - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'inn')), - type: NamedTypeNode(name: NameNode(value: 'Int'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []), - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'li')), - type: ListTypeNode( - type: NamedTypeNode( - name: NameNode(value: 'Int'), isNonNull: false), - isNonNull: false), - defaultValue: DefaultValueNode(value: null), - directives: []), - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'linn')), - type: ListTypeNode( - type: NamedTypeNode( - name: NameNode(value: 'Int'), isNonNull: true), - isNonNull: false), - defaultValue: DefaultValueNode(value: null), - directives: []), - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'lnni')), - type: ListTypeNode( - type: NamedTypeNode( - name: NameNode(value: 'Int'), isNonNull: false), - isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []), - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'lnninn')), - type: ListTypeNode( - type: NamedTypeNode( - name: NameNode(value: 'Int'), isNonNull: true), - isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []), - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'matrix')), - type: ListTypeNode( - type: ListTypeNode( - type: NamedTypeNode( - name: NameNode(value: 'Int'), isNonNull: false), - isNonNull: false), - isNonNull: false), - defaultValue: DefaultValueNode(value: null), - directives: []), - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'matrixnn')), - type: ListTypeNode( - type: ListTypeNode( - type: NamedTypeNode( - name: NameNode(value: 'Int'), isNonNull: true), - isNonNull: true), - isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'someQuery'), + type: OperationType.query, + name: NameNode(value: 'some_query'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'i')), + type: NamedTypeNode( + name: NameNode(value: 'Int'), + isNonNull: false, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'inn')), + type: NamedTypeNode( + name: NameNode(value: 'Int'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'li')), + type: ListTypeNode( + type: NamedTypeNode( + name: NameNode(value: 'Int'), + isNonNull: false, + ), + isNonNull: false, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'linn')), + type: ListTypeNode( + type: NamedTypeNode( + name: NameNode(value: 'Int'), + isNonNull: true, + ), + isNonNull: false, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'lnni')), + type: ListTypeNode( + type: NamedTypeNode( + name: NameNode(value: 'Int'), + isNonNull: false, + ), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'lnninn')), + type: ListTypeNode( + type: NamedTypeNode( + name: NameNode(value: 'Int'), + isNonNull: true, + ), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'matrix')), + type: ListTypeNode( + type: ListTypeNode( + type: NamedTypeNode( + name: NameNode(value: 'Int'), + isNonNull: false, + ), + isNonNull: false, + ), + isNonNull: false, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'matrixnn')), + type: ListTypeNode( + type: ListTypeNode( + type: NamedTypeNode( + name: NameNode(value: 'Int'), + isNonNull: true, + ), + isNonNull: true, + ), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ), + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'someQuery'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'i'), + value: VariableNode(name: NameNode(value: 'i')), + ), + ArgumentNode( + name: NameNode(value: 'inn'), + value: VariableNode(name: NameNode(value: 'inn')), + ), + ArgumentNode( + name: NameNode(value: 'li'), + value: VariableNode(name: NameNode(value: 'li')), + ), + ArgumentNode( + name: NameNode(value: 'linn'), + value: VariableNode(name: NameNode(value: 'linn')), + ), + ArgumentNode( + name: NameNode(value: 'lnni'), + value: VariableNode(name: NameNode(value: 'lnni')), + ), + ArgumentNode( + name: NameNode(value: 'lnninn'), + value: VariableNode(name: NameNode(value: 'lnninn')), + ), + ArgumentNode( + name: NameNode(value: 'matrix'), + value: VariableNode(name: NameNode(value: 'matrix')), + ), + ArgumentNode( + name: NameNode(value: 'matrixnn'), + value: VariableNode(name: NameNode(value: 'matrixnn')), + ), + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 's'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'i'), - value: VariableNode(name: NameNode(value: 'i'))), - ArgumentNode( - name: NameNode(value: 'inn'), - value: VariableNode(name: NameNode(value: 'inn'))), - ArgumentNode( - name: NameNode(value: 'li'), - value: VariableNode(name: NameNode(value: 'li'))), - ArgumentNode( - name: NameNode(value: 'linn'), - value: VariableNode(name: NameNode(value: 'linn'))), - ArgumentNode( - name: NameNode(value: 'lnni'), - value: VariableNode(name: NameNode(value: 'lnni'))), - ArgumentNode( - name: NameNode(value: 'lnninn'), - value: VariableNode(name: NameNode(value: 'lnninn'))), - ArgumentNode( - name: NameNode(value: 'matrix'), - value: VariableNode(name: NameNode(value: 'matrix'))), - ArgumentNode( - name: NameNode(value: 'matrixnn'), - value: VariableNode(name: NameNode(value: 'matrixnn'))) - ], + arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 's'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ) + ]), + ) + ]), + ) ]); class SomeQueryQuery extends GraphQLQuery { diff --git a/test/query_generator/mutations_and_inputs/recursive_input_test.dart b/test/query_generator/mutations_and_inputs/recursive_input_test.dart index 1f8e0204..2b7a9972 100644 --- a/test/query_generator/mutations_and_inputs/recursive_input_test.dart +++ b/test/query_generator/mutations_and_inputs/recursive_input_test.dart @@ -75,7 +75,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -99,7 +98,10 @@ class Custom$Mutation extends JsonSerializable with EquatableMixin { @JsonSerializable(explicitToJson: true) class Input extends JsonSerializable with EquatableMixin { - Input({this.and, this.or}); + Input({ + this.and, + this.or, + }); factory Input.fromJson(Map json) => _$InputFromJson(json); diff --git a/test/query_generator/naming/casing_conversion_test.dart b/test/query_generator/naming/casing_conversion_test.dart index aa031cf8..5fe25609 100644 --- a/test/query_generator/naming/casing_conversion_test.dart +++ b/test/query_generator/naming/casing_conversion_test.dart @@ -195,7 +195,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -253,12 +252,13 @@ class SomeQuery$Query extends JsonSerializable with EquatableMixin { @JsonSerializable(explicitToJson: true) class Input extends JsonSerializable with EquatableMixin { - Input( - {this.camelCaseField, - this.pascalCaseField, - this.snakeCaseField, - this.screamingSnakeCaseField, - this.e}); + Input({ + this.camelCaseField, + this.pascalCaseField, + this.snakeCaseField, + this.screamingSnakeCaseField, + this.e, + }); factory Input.fromJson(Map json) => _$InputFromJson(json); @@ -320,60 +320,71 @@ class SomeQueryArguments extends JsonSerializable with EquatableMixin { final SOME_QUERY_QUERY_DOCUMENT_OPERATION_NAME = 'some_query'; final SOME_QUERY_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'some_query'), - variableDefinitions: [ - VariableDefinitionNode( - variable: VariableNode(name: NameNode(value: 'filter')), - type: - NamedTypeNode(name: NameNode(value: 'Input'), isNonNull: true), - defaultValue: DefaultValueNode(value: null), - directives: []) - ], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'query'), + type: OperationType.query, + name: NameNode(value: 'some_query'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'filter')), + type: NamedTypeNode( + name: NameNode(value: 'Input'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'query'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'filter'), + value: VariableNode(name: NameNode(value: 'filter')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'camelCaseField'), alias: null, - arguments: [ - ArgumentNode( - name: NameNode(value: 'filter'), - value: VariableNode(name: NameNode(value: 'filter'))) - ], + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'PascalCaseField'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'snake_case_field'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'SCREAMING_SNAKE_CASE_FIELD'), + alias: null, + arguments: [], directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'camelCaseField'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'PascalCaseField'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'snake_case_field'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'SCREAMING_SNAKE_CASE_FIELD'), - alias: null, - arguments: [], - directives: [], - selectionSet: null), - FieldNode( - name: NameNode(value: 'e'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'e'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ) + ]), + ) ]); class SomeQueryQuery extends GraphQLQuery { diff --git a/test/query_generator/naming/simple_naming_test.dart b/test/query_generator/naming/simple_naming_test.dart index 9f94900a..9e5afe21 100644 --- a/test/query_generator/naming/simple_naming_test.dart +++ b/test/query_generator/naming/simple_naming_test.dart @@ -100,7 +100,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:artemis/artemis.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -156,32 +155,36 @@ class ClientEventsData$Query extends JsonSerializable with EquatableMixin { final CLIENT_EVENTS_DATA_QUERY_DOCUMENT_OPERATION_NAME = 'ClientEventsData'; final CLIENT_EVENTS_DATA_QUERY_DOCUMENT = DocumentNode(definitions: [ OperationDefinitionNode( - type: OperationType.query, - name: NameNode(value: 'ClientEventsData'), - variableDefinitions: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'clientEvents'), + type: OperationType.query, + name: NameNode(value: 'ClientEventsData'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'clientEvents'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'items'), alias: null, arguments: [], directives: [], selectionSet: SelectionSetNode(selections: [ FieldNode( - name: NameNode(value: 'items'), - alias: null, - arguments: [], - directives: [], - selectionSet: SelectionSetNode(selections: [ - FieldNode( - name: NameNode(value: 'type'), - alias: null, - arguments: [], - directives: [], - selectionSet: null) - ])) - ])) - ])) + name: NameNode(value: 'type'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ) + ]), + ) + ]), + ) + ]), + ) ]); class ClientEventsDataQuery diff --git a/test/query_generator/nnbd_test.dart b/test/query_generator/nnbd_test.dart index c1cd0b05..4977b3a6 100644 --- a/test/query_generator/nnbd_test.dart +++ b/test/query_generator/nnbd_test.dart @@ -74,7 +74,6 @@ final libraryDefinition = ]); const output = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -164,7 +163,6 @@ final listsLibraryDefinition = ]); const listsOutput = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/query_generator_test.dart b/test/query_generator/query_generator_test.dart index f687cdb9..9ca37340 100644 --- a/test/query_generator/query_generator_test.dart +++ b/test/query_generator/query_generator_test.dart @@ -45,7 +45,6 @@ void main() { suffix: r'Query') ]), generatedFile: r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -163,7 +162,6 @@ class SomeQuery$SomeObject extends JsonSerializable with EquatableMixin { suffix: r'Query') ]), generatedFile: r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/scalars/custom_scalars_test.dart b/test/query_generator/scalars/custom_scalars_test.dart index 7bb77040..8326bdb7 100644 --- a/test/query_generator/scalars/custom_scalars_test.dart +++ b/test/query_generator/scalars/custom_scalars_test.dart @@ -233,7 +233,6 @@ final LibraryDefinition libraryDefinitionWithCustomImports = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -260,7 +259,6 @@ class Query$SomeObject extends JsonSerializable with EquatableMixin { const generatedFileWithCustomParserFns = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; @@ -289,7 +287,6 @@ class Query$SomeObject extends JsonSerializable with EquatableMixin { const generatedFileWithCustomImports = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/scalars/scalars_test.dart b/test/query_generator/scalars/scalars_test.dart index a5b371f5..c3b4cda9 100644 --- a/test/query_generator/scalars/scalars_test.dart +++ b/test/query_generator/scalars/scalars_test.dart @@ -100,7 +100,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/scalars/unused_custom_scalars_test.dart b/test/query_generator/scalars/unused_custom_scalars_test.dart index 508f185a..acb64be7 100644 --- a/test/query_generator/scalars/unused_custom_scalars_test.dart +++ b/test/query_generator/scalars/unused_custom_scalars_test.dart @@ -60,7 +60,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/subscription_test.dart b/test/query_generator/subscription_test.dart index 9dc8357a..f40c873f 100644 --- a/test/query_generator/subscription_test.dart +++ b/test/query_generator/subscription_test.dart @@ -130,7 +130,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/union/union_types_test.dart b/test/query_generator/union/union_types_test.dart index 0385116f..c0f1d04a 100644 --- a/test/query_generator/union/union_types_test.dart +++ b/test/query_generator/union/union_types_test.dart @@ -202,7 +202,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart'; diff --git a/test/query_generator/union/union_with_nested_types_test.dart b/test/query_generator/union/union_with_nested_types_test.dart index 1c59ca77..949e3c86 100644 --- a/test/query_generator/union/union_with_nested_types_test.dart +++ b/test/query_generator/union/union_with_nested_types_test.dart @@ -198,7 +198,6 @@ final LibraryDefinition libraryDefinition = ]); const generatedFile = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -// @dart = 2.12 import 'package:json_annotation/json_annotation.dart'; import 'package:equatable/equatable.dart';