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

Support for input fields called 'props' #418

Open
anlumo opened this issue Oct 3, 2023 · 2 comments
Open

Support for input fields called 'props' #418

anlumo opened this issue Oct 3, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@anlumo
Copy link

anlumo commented Oct 3, 2023

Bug description

In my service's schema, there's a type like this:

input Update {
	id: UUID!
	name: String
	props: MyProps
}

This gets translated to this Dart code:

@JsonSerializable(explicitToJson: true)
class Update extends JsonSerializable with EquatableMixin {
  Update({
    required this.id,
    this.name,
    this.props,
  });

  factory Update.fromJson(Map<String, dynamic> json) =>
      _$UpdateFromJson(json);

  @JsonKey(
      fromJson: fromGraphQLUuidToDartString,
      toJson: fromDartStringToGraphQLUuid)
  late String id;

  String? name;

  @JsonKey(
      fromJson: fromGraphQLMyPropsNullableToDartMyPropsNullable,
      toJson: fromDartMyPropsNullableToGraphQLMyPropsNullable)
  MyProps? props;

  @override
  List<Object?> get props =>
      [id, name, props];
  @override
  Map<String, dynamic> toJson() => _$UpdateToJson(this);
}

This doesn't compile, because there's both a field props and a getter props.

Specs

Artemis version: 7.13.0-beta.2

build.yaml:
targets:
  $default:
    builders:
      artemis:
        options:
          schema_mapping:
            - schema: lib/modules/graphql/schema.graphql
              queries_glob: lib/modules/graphql/queries/*.graphql
              output: lib/modules/graphql/models/graphql_api.dart
              naming_scheme: pathedWithFields
          scalar_mapping:
            - graphql_type: UUID
              custom_parser_import: "package:myproject/modules/graphql/scalars/uuid_scalar.dart"
              dart_type: String
            - graphql_type: MyProps
              custom_parser_import: "package:myproject/modules/graphql/scalars/my_props_scalar.dart"
              dart_type: MyProps
              use_custom_parser: true
    sources:
      - $package$
      - lib/**
      - pubspec.yaml
@anlumo anlumo added the bug Something isn't working label Oct 3, 2023
@anlumo anlumo changed the title Support for struct fields called 'props' Support for input fields called 'props' Oct 3, 2023
@vasilich6107
Copy link
Collaborator

This package is not nainatined anymore)

@vasilich6107
Copy link
Collaborator

@comigor it will be nice to archive this package

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

2 participants