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

Support for input fields called 'props' #418

@anlumo

Description

@anlumo

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
Details

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions