Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

*ComparisonExp classes duplicates #416

Open
JSBmanD opened this issue Jul 13, 2023 · 0 comments
Open

*ComparisonExp classes duplicates #416

JSBmanD opened this issue Jul 13, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@JSBmanD
Copy link

JSBmanD commented Jul 13, 2023

Bug description

Currently there's a problem if you want to generate requests with variables - in every generated file "*.graphql.dart" will be StringComparisonExp, IntComparisonExp or any other comparators. When you will export these files in the library - you will have conflict of class names and need to hide all these duplicated classes with directive hide. Good option to solve this will be having these comparators in the library or generating additional file with them.

Specs

Artemis version: ref 0301b81

build.yaml:
targets:
  $default:
    sources:
      - lib/**
      - graphql/**
      - $package$
      - schema.graphql
    builders:
      artemis:
        options:
          generate_helpers: true
          schema_mapping:
            - schema: schema.graphql
              queries_glob: graphql/files.graphql
              output: lib/src/graphql/files.graphql.dart
          custom_parser_import: 'package:graph_test/src/graphql_parsers/datetime_parser.dart'
          scalar_mapping:
            - graphql_type: timestamp
              dart_type: DateTime
              use_custom_parser: true
            - graphql_type: bigint
              dart_type: int
            - graphql_type: json
              dart_type: String
Artemis output:
[INFO] Entrypoint:Generating build script...
[INFO] Entrypoint:Generating build script completed, took 143ms

[INFO] BuildDefinition:Initializing inputs
[INFO] BuildDefinition:Reading cached asset graph...
[WARNING] BuildDefinition:
Throwing away cached asset graph because the build phases have changed. This most commonly would happen as a result of adding a new dependency or updating your dependencies.
[INFO] BuildDefinition:Cleaning up outputs from previous builds....
[INFO] BuildDefinition:Cleaning up outputs from previous builds. completed, took 1ms

[INFO] Entrypoint:Generating build script...
[INFO] Entrypoint:Generating build script completed, took 26ms

[WARNING] Bootstrap:
Invalidated precompiled build script due to missing asset graph.
[INFO] Bootstrap:Precompiling build script......
[INFO] Bootstrap:Precompiling build script... completed, took 479ms

[INFO] BuildDefinition:Initializing inputs
[INFO] BuildDefinition:Building new asset graph...
[INFO] BuildDefinition:Building new asset graph completed, took 371ms

[INFO] BuildDefinition:Checking for unexpected pre-existing outputs....
[INFO] BuildDefinition:Checking for unexpected pre-existing outputs. completed, took 0ms

[INFO] Build:Running build...
[FINE] artemis on lib/$lib$:-> Class
[FINE] artemis on lib/$lib$:┌ [TypeName(name:r'GetFilesStreaming'), TypeName(name:r'subscription_root')][subscription_root][null null] ()
[FINE] artemis on lib/$lib$:|   [TypeName(name:r'GetFilesStreaming'), TypeName(name:r'subscription_root')][subscription_root][ClassName(name:r'files') ClassPropertyName(name:r'files')] -> List<GetFilesStreaming$SubscriptionRoot$Files>
[FINE] artemis on lib/$lib$:|   -> Class
[FINE] artemis on lib/$lib$:|   ┌ [TypeName(name:r'GetFilesStreaming'), TypeName(name:r'subscription_root'), ClassName(name:r'files')][files][null null] ()
[FINE] artemis on lib/$lib$:|   |   [TypeName(name:r'GetFilesStreaming'), TypeName(name:r'subscription_root'), ClassName(name:r'files')][files][ClassName(name:r'Int') ClassPropertyName(name:r'id')] -> int
[FINE] artemis on lib/$lib$:|   |   [TypeName(name:r'GetFilesStreaming'), TypeName(name:r'subscription_root'), ClassName(name:r'files')][files][ClassName(name:r'String') ClassPropertyName(name:r'name')] -> String
[FINE] artemis on lib/$lib$:|   |   [TypeName(name:r'GetFilesStreaming'), TypeName(name:r'subscription_root'), ClassName(name:r'files')][files][ClassName(name:r'String') ClassPropertyName(name:r'download_url')] -> String
[FINE] artemis on lib/$lib$:|   |   [TypeName(name:r'GetFilesStreaming'), TypeName(name:r'subscription_root'), ClassName(name:r'files')][files][ClassName(name:r'String') ClassPropertyName(name:r'delete_url')] -> String
[FINE] artemis on lib/$lib$:|   |   [TypeName(name:r'GetFilesStreaming'), TypeName(name:r'subscription_root'), ClassName(name:r'files')][files][ClassName(name:r'timestamp') ClassPropertyName(name:r'time')] -> DateTime
[FINE] artemis on lib/$lib$:|   └ [TypeName(name:r'GetFilesStreaming'), TypeName(name:r'subscription_root'), ClassName(name:r'files')][files][null null] ()
[FINE] artemis on lib/$lib$:|   <- Generated class GetFilesStreaming$SubscriptionRoot$Files.
[FINE] artemis on lib/$lib$:└ [TypeName(name:r'GetFilesStreaming'), TypeName(name:r'subscription_root')][subscription_root][null null] ()
[FINE] artemis on lib/$lib$:<- Generated class GetFilesStreaming$SubscriptionRoot.
[FINE] artemis on lib/$lib$:-> Class
[FINE] artemis on lib/$lib$:┌ [TypeName(name:r'UpdateFile'), TypeName(name:r'mutation_root')][mutation_root][null null] ()
[FINE] artemis on lib/$lib$:|   [TypeName(name:r'UpdateFile'), TypeName(name:r'mutation_root')][mutation_root][ClassName(name:r'files_mutation_response') ClassPropertyName(name:r'update_files')] -> UpdateFile$MutationRoot$FilesMutationResponse?
[FINE] artemis on lib/$lib$:|   -> Class
[FINE] artemis on lib/$lib$:|   ┌ [TypeName(name:r'UpdateFile'), TypeName(name:r'mutation_root'), ClassName(name:r'files_mutation_response')][files_mutation_response][null null] ()
[FINE] artemis on lib/$lib$:|   |   [TypeName(name:r'UpdateFile'), TypeName(name:r'mutation_root'), ClassName(name:r'files_mutation_response')][files_mutation_response][ClassName(name:r'Int') ClassPropertyName(name:r'affected_rows')] -> int
[FINE] artemis on lib/$lib$:|   |   [TypeName(name:r'UpdateFile'), TypeName(name:r'mutation_root'), ClassName(name:r'files_mutation_response')][files_mutation_response][ClassName(name:r'files') ClassPropertyName(name:r'returning')] -> List<UpdateFile$MutationRoot$FilesMutationResponse$Files>
[FINE] artemis on lib/$lib$:|   |   -> Class
[FINE] artemis on lib/$lib$:|   |   ┌ [TypeName(name:r'UpdateFile'), TypeName(name:r'mutation_root'), ClassName(name:r'files_mutation_response'), ClassName(name:r'files')][files][null null] ()
[FINE] artemis on lib/$lib$:|   |   |   [TypeName(name:r'UpdateFile'), TypeName(name:r'mutation_root'), ClassName(name:r'files_mutation_response'), ClassName(name:r'files')][files][ClassName(name:r'Int') ClassPropertyName(name:r'id')] -> int
[FINE] artemis on lib/$lib$:|   |   └ [TypeName(name:r'UpdateFile'), TypeName(name:r'mutation_root'), ClassName(name:r'files_mutation_response'), ClassName(name:r'files')][files][null null] ()
[FINE] artemis on lib/$lib$:|   |   <- Generated class UpdateFile$MutationRoot$FilesMutationResponse$Files.
[FINE] artemis on lib/$lib$:|   └ [TypeName(name:r'UpdateFile'), TypeName(name:r'mutation_root'), ClassName(name:r'files_mutation_response')][files_mutation_response][null null] ()
[FINE] artemis on lib/$lib$:|   <- Generated class UpdateFile$MutationRoot$FilesMutationResponse.
[FINE] artemis on lib/$lib$:└ [TypeName(name:r'UpdateFile'), TypeName(name:r'mutation_root')][mutation_root][null null] ()
[FINE] artemis on lib/$lib$:<- Generated class UpdateFile$MutationRoot.
[FINE] artemis on lib/$lib$:-> Input class
[FINE] artemis on lib/$lib$:┌ [][files_set_input]
[FINE] artemis on lib/$lib$:|   [][files_set_input][ClassName(name:r'String') ClassPropertyName(name:r'delete_url')] -> String?
[FINE] artemis on lib/$lib$:|   [][files_set_input][ClassName(name:r'String') ClassPropertyName(name:r'download_url')] -> String?
[FINE] artemis on lib/$lib$:|   [][files_set_input][ClassName(name:r'Int') ClassPropertyName(name:r'id')] -> int?
[FINE] artemis on lib/$lib$:|   [][files_set_input][ClassName(name:r'String') ClassPropertyName(name:r'name')] -> String?
[FINE] artemis on lib/$lib$:|   [][files_set_input][ClassName(name:r'timestamp') ClassPropertyName(name:r'time')] -> DateTime?
[FINE] artemis on lib/$lib$:└ [][files_set_input]
[FINE] artemis on lib/$lib$:<- Generated input class FilesSetInput.
[FINE] artemis on lib/$lib$:-> Class
[FINE] artemis on lib/$lib$:┌ [TypeName(name:r'GetFile'), TypeName(name:r'query_root')][query_root][null null] ()
[FINE] artemis on lib/$lib$:|   [TypeName(name:r'GetFile'), TypeName(name:r'query_root')][query_root][ClassName(name:r'files') ClassPropertyName(name:r'files')] -> List<GetFile$QueryRoot$Files>
[FINE] artemis on lib/$lib$:|   -> Class
[FINE] artemis on lib/$lib$:|   ┌ [TypeName(name:r'GetFile'), TypeName(name:r'query_root'), ClassName(name:r'files')][files][null null] ()
[FINE] artemis on lib/$lib$:|   |   [TypeName(name:r'GetFile'), TypeName(name:r'query_root'), ClassName(name:r'files')][files][ClassName(name:r'Int') ClassPropertyName(name:r'id')] -> int
[FINE] artemis on lib/$lib$:|   |   [TypeName(name:r'GetFile'), TypeName(name:r'query_root'), ClassName(name:r'files')][files][ClassName(name:r'String') ClassPropertyName(name:r'name')] -> String
[FINE] artemis on lib/$lib$:|   |   [TypeName(name:r'GetFile'), TypeName(name:r'query_root'), ClassName(name:r'files')][files][ClassName(name:r'timestamp') ClassPropertyName(name:r'time')] -> DateTime
[FINE] artemis on lib/$lib$:|   |   [TypeName(name:r'GetFile'), TypeName(name:r'query_root'), ClassName(name:r'files')][files][ClassName(name:r'String') ClassPropertyName(name:r'download_url')] -> String
[FINE] artemis on lib/$lib$:|   |   [TypeName(name:r'GetFile'), TypeName(name:r'query_root'), ClassName(name:r'files')][files][ClassName(name:r'String') ClassPropertyName(name:r'delete_url')] -> String
[FINE] artemis on lib/$lib$:|   └ [TypeName(name:r'GetFile'), TypeName(name:r'query_root'), ClassName(name:r'files')][files][null null] ()
[FINE] artemis on lib/$lib$:|   <- Generated class GetFile$QueryRoot$Files.
[FINE] artemis on lib/$lib$:└ [TypeName(name:r'GetFile'), TypeName(name:r'query_root')][query_root][null null] ()
[FINE] artemis on lib/$lib$:<- Generated class GetFile$QueryRoot.
[FINE] artemis on lib/$lib$:-> Input class
[FINE] artemis on lib/$lib$:┌ [][files_bool_exp]
[FINE] artemis on lib/$lib$:|   [][files_bool_exp][ClassName(name:r'files_bool_exp') ClassPropertyName(name:r'_and')] -> List<FilesBoolExp>?
[FINE] artemis on lib/$lib$:|   [][files_bool_exp][ClassName(name:r'files_bool_exp') ClassPropertyName(name:r'_not')] -> FilesBoolExp?
[FINE] artemis on lib/$lib$:|   [][files_bool_exp][ClassName(name:r'files_bool_exp') ClassPropertyName(name:r'_or')] -> List<FilesBoolExp>?
[FINE] artemis on lib/$lib$:|   [][files_bool_exp][ClassName(name:r'String_comparison_exp') ClassPropertyName(name:r'delete_url')] -> StringComparisonExp?
[FINE] artemis on lib/$lib$:|   [][files_bool_exp][ClassName(name:r'String_comparison_exp') ClassPropertyName(name:r'download_url')] -> StringComparisonExp?
[FINE] artemis on lib/$lib$:|   [][files_bool_exp][ClassName(name:r'Int_comparison_exp') ClassPropertyName(name:r'id')] -> IntComparisonExp?
[FINE] artemis on lib/$lib$:|   [][files_bool_exp][ClassName(name:r'String_comparison_exp') ClassPropertyName(name:r'name')] -> StringComparisonExp?
[FINE] artemis on lib/$lib$:|   [][files_bool_exp][ClassName(name:r'timestamp_comparison_exp') ClassPropertyName(name:r'time')] -> TimestampComparisonExp?
[FINE] artemis on lib/$lib$:└ [][files_bool_exp]
[FINE] artemis on lib/$lib$:<- Generated input class FilesBoolExp.
[FINE] artemis on lib/$lib$:-> Input class
[FINE] artemis on lib/$lib$:┌ [][String_comparison_exp]
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_eq')] -> String?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_gt')] -> String?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_gte')] -> String?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_ilike')] -> String?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_in')] -> List<String>?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_iregex')] -> String?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'Boolean') ClassPropertyName(name:r'_is_null')] -> bool?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_like')] -> String?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_lt')] -> String?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_lte')] -> String?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_neq')] -> String?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_nilike')] -> String?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_nin')] -> List<String>?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_niregex')] -> String?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_nlike')] -> String?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_nregex')] -> String?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_nsimilar')] -> String?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_regex')] -> String?
[FINE] artemis on lib/$lib$:|   [][String_comparison_exp][ClassName(name:r'String') ClassPropertyName(name:r'_similar')] -> String?
[FINE] artemis on lib/$lib$:└ [][String_comparison_exp]
[FINE] artemis on lib/$lib$:<- Generated input class StringComparisonExp.
[FINE] artemis on lib/$lib$:-> Input class
[FINE] artemis on lib/$lib$:┌ [][Int_comparison_exp]
[FINE] artemis on lib/$lib$:|   [][Int_comparison_exp][ClassName(name:r'Int') ClassPropertyName(name:r'_eq')] -> int?
[FINE] artemis on lib/$lib$:|   [][Int_comparison_exp][ClassName(name:r'Int') ClassPropertyName(name:r'_gt')] -> int?
[FINE] artemis on lib/$lib$:|   [][Int_comparison_exp][ClassName(name:r'Int') ClassPropertyName(name:r'_gte')] -> int?
[FINE] artemis on lib/$lib$:|   [][Int_comparison_exp][ClassName(name:r'Int') ClassPropertyName(name:r'_in')] -> List<int>?
[FINE] artemis on lib/$lib$:|   [][Int_comparison_exp][ClassName(name:r'Boolean') ClassPropertyName(name:r'_is_null')] -> bool?
[FINE] artemis on lib/$lib$:|   [][Int_comparison_exp][ClassName(name:r'Int') ClassPropertyName(name:r'_lt')] -> int?
[FINE] artemis on lib/$lib$:|   [][Int_comparison_exp][ClassName(name:r'Int') ClassPropertyName(name:r'_lte')] -> int?
[FINE] artemis on lib/$lib$:|   [][Int_comparison_exp][ClassName(name:r'Int') ClassPropertyName(name:r'_neq')] -> int?
[FINE] artemis on lib/$lib$:|   [][Int_comparison_exp][ClassName(name:r'Int') ClassPropertyName(name:r'_nin')] -> List<int>?
[FINE] artemis on lib/$lib$:└ [][Int_comparison_exp]
[FINE] artemis on lib/$lib$:<- Generated input class IntComparisonExp.
[FINE] artemis on lib/$lib$:-> Input class
[FINE] artemis on lib/$lib$:┌ [][timestamp_comparison_exp]
[FINE] artemis on lib/$lib$:|   [][timestamp_comparison_exp][ClassName(name:r'timestamp') ClassPropertyName(name:r'_eq')] -> DateTime?
[FINE] artemis on lib/$lib$:|   [][timestamp_comparison_exp][ClassName(name:r'timestamp') ClassPropertyName(name:r'_gt')] -> DateTime?
[FINE] artemis on lib/$lib$:|   [][timestamp_comparison_exp][ClassName(name:r'timestamp') ClassPropertyName(name:r'_gte')] -> DateTime?
[FINE] artemis on lib/$lib$:|   [][timestamp_comparison_exp][ClassName(name:r'timestamp') ClassPropertyName(name:r'_in')] -> List<DateTime>?
[FINE] artemis on lib/$lib$:|   [][timestamp_comparison_exp][ClassName(name:r'Boolean') ClassPropertyName(name:r'_is_null')] -> bool?
[FINE] artemis on lib/$lib$:|   [][timestamp_comparison_exp][ClassName(name:r'timestamp') ClassPropertyName(name:r'_lt')] -> DateTime?
[FINE] artemis on lib/$lib$:|   [][timestamp_comparison_exp][ClassName(name:r'timestamp') ClassPropertyName(name:r'_lte')] -> DateTime?
[FINE] artemis on lib/$lib$:|   [][timestamp_comparison_exp][ClassName(name:r'timestamp') ClassPropertyName(name:r'_neq')] -> DateTime?
[FINE] artemis on lib/$lib$:|   [][timestamp_comparison_exp][ClassName(name:r'timestamp') ClassPropertyName(name:r'_nin')] -> List<DateTime>?
[FINE] artemis on lib/$lib$:└ [][timestamp_comparison_exp]
[FINE] artemis on lib/$lib$:<- Generated input class TimestampComparisonExp.
[FINE] json_serializable on lib/graphql_comparsion_problem.dart:Running JsonSerializableGenerator - 1 of 2
[FINE] json_serializable on lib/graphql_comparsion_problem.dart:Running JsonLiteralGenerator - 2 of 2
[FINE] json_serializable on lib/src/graphql/files.graphql.dart:Running JsonSerializableGenerator - 1 of 2
[WARNING] json_serializable on lib/src/graphql/files.graphql.dart:
Could not read the "pubspec.yaml` file associated with this package. Usage of package:json_annotation could not be verified.
[FINE] json_serializable on lib/src/graphql/files.graphql.dart:Running JsonLiteralGenerator - 2 of 2
[INFO] Build:Running build completed, took 1.5s

[INFO] Build:Caching finalized dependency graph...
[INFO] Build:Caching finalized dependency graph completed, took 11ms

[INFO] Build:Succeeded after 1.5s with 3 outputs (6 actions)

I have reproducible example here except for that it has only 1 request. But the idea is clear I think.
https://github.com/JSBmanD/graphql_comparsion_problem

@JSBmanD JSBmanD added the bug Something isn't working label Jul 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant