heftapp / graphql_codegen

MIT License
146 stars 53 forks source link

Codegen ignores certain Types #317

Closed nachoarreola closed 11 months ago

nachoarreola commented 1 year ago

I have a schema with certain queries, mutations and types, but codegen ignores certain types and do not generate classes for them. Why could this be? But it doesnt show an error/warning for them either, why could this be?

Thanks.

github-actions[bot] commented 1 year ago

👋 @nachoarreola Thank you for raising an issue. I will investigate the issue and get back to you as soon as possible. Please make sure you have provided enough context.

This library is created and maintained by me, @budde377. Please consider supporting my work and ensure our survival by donating here.

budde377 commented 1 year ago

Thanks for reaching out. Can you please provide an example of the operations you are talking about?

nachoarreola commented 1 year ago

sure ill provide that tomorrow but I noticed that you are collaborator of Ferry project, would you recommend using it instead as an end to end solution? thanks

budde377 commented 1 year ago

I've found that this project was better suited for how I used fragments to communicate data requirements between widgets better, but I will leave it to you to see if ferry suits your needs. :)

nachoarreola commented 1 year ago

Can you provide an example of why did you like this better?

Regarding the actual issue, heres my schema:

directive @tag(
  name: String!
) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

type Query {
  myEvents(): [Event]
  eventById(): Event
}

type Mutation {
  createEvent(request: CreateEventRequestInput): Event
  addParticipantsToEvent(
    eventId: UUID!
    participants: [ParticipantInput]
  ): Event
  removeParticipantsFromEvent(eventId: UUID!, participantIds: [UUID!]): Event
  markParticipantsAsHosts(eventId: UUID!, participantIds: [UUID!]): Event
  unmarkParticipantsAsHosts(eventId: UUID!, participantIds: [UUID!]): Event
}

scalar UUID @specifiedBy(url: "https://tools.ietf.org/html/rfc4122")

input CreateEventRequestInput {
  title: String
  date: DateTime!
  location: String
  amount: Int!
  participants: [CreateParticipantRequestInput]
  description: String
}

type Event {
  id: UUID!
  title: String
  date: DateTime!
  location: String
  amount: Int!
  participants: [Participant]
  description: String
}

input ParticipantInput {
  id: UUID!
  name: String
  email: String
  isHost: Boolean!
}

"""
The `DateTime` scalar represents an ISO-8601 compliant date time type.
"""
scalar DateTime @specifiedBy(url: "https://www.graphql-scalars.com/date-time")

input CreateParticipantRequestInput {
  name: String
  email: String
  isHost: Boolean!
}

type Participant {
  id: UUID!
  name: String
  email: String
  isHost: Boolean!
}

This is what it generates:

class Input$CreateEventRequestInput {
  factory Input$CreateEventRequestInput({
    String? title,
    required String date,
    String? location,
    required int amount,
    List<Input$CreateParticipantRequestInput?>? participants,
    String? description,
  }) =>
      Input$CreateEventRequestInput._({
        if (title != null) r'title': title,
        r'date': date,
        if (location != null) r'location': location,
        r'amount': amount,
        if (participants != null) r'participants': participants,
        if (description != null) r'description': description,
      });

  Input$CreateEventRequestInput._(this._$data);

  factory Input$CreateEventRequestInput.fromJson(Map<String, dynamic> data) {
    final result$data = <String, dynamic>{};
    if (data.containsKey('title')) {
      final l$title = data['title'];
      result$data['title'] = (l$title as String?);
    }
    final l$date = data['date'];
    result$data['date'] = (l$date as String);
    if (data.containsKey('location')) {
      final l$location = data['location'];
      result$data['location'] = (l$location as String?);
    }
    final l$amount = data['amount'];
    result$data['amount'] = (l$amount as int);
    if (data.containsKey('participants')) {
      final l$participants = data['participants'];
      result$data['participants'] = (l$participants as List<dynamic>?)
          ?.map((e) => e == null
              ? null
              : Input$CreateParticipantRequestInput.fromJson(
                  (e as Map<String, dynamic>)))
          .toList();
    }
    if (data.containsKey('description')) {
      final l$description = data['description'];
      result$data['description'] = (l$description as String?);
    }
    return Input$CreateEventRequestInput._(result$data);
  }

  Map<String, dynamic> _$data;

  String? get title => (_$data['title'] as String?);

  String get date => (_$data['date'] as String);

  String? get location => (_$data['location'] as String?);

  int get amount => (_$data['amount'] as int);

  List<Input$CreateParticipantRequestInput?>? get participants =>
      (_$data['participants'] as List<Input$CreateParticipantRequestInput?>?);

  String? get description => (_$data['description'] as String?);

  Map<String, dynamic> toJson() {
    final result$data = <String, dynamic>{};
    if (_$data.containsKey('title')) {
      final l$title = title;
      result$data['title'] = l$title;
    }
    final l$date = date;
    result$data['date'] = l$date;
    if (_$data.containsKey('location')) {
      final l$location = location;
      result$data['location'] = l$location;
    }
    final l$amount = amount;
    result$data['amount'] = l$amount;
    if (_$data.containsKey('participants')) {
      final l$participants = participants;
      result$data['participants'] =
          l$participants?.map((e) => e?.toJson()).toList();
    }
    if (_$data.containsKey('description')) {
      final l$description = description;
      result$data['description'] = l$description;
    }
    return result$data;
  }

  CopyWith$Input$CreateEventRequestInput<Input$CreateEventRequestInput>
      get copyWith => CopyWith$Input$CreateEventRequestInput(
            this,
            (i) => i,
          );

  @override
  bool operator ==(Object other) {
    if (identical(this, other)) {
      return true;
    }
    if (!(other is Input$CreateEventRequestInput) ||
        runtimeType != other.runtimeType) {
      return false;
    }
    final l$title = title;
    final lOther$title = other.title;
    if (_$data.containsKey('title') != other._$data.containsKey('title')) {
      return false;
    }
    if (l$title != lOther$title) {
      return false;
    }
    final l$date = date;
    final lOther$date = other.date;
    if (l$date != lOther$date) {
      return false;
    }
    final l$location = location;
    final lOther$location = other.location;
    if (_$data.containsKey('location') !=
        other._$data.containsKey('location')) {
      return false;
    }
    if (l$location != lOther$location) {
      return false;
    }
    final l$amount = amount;
    final lOther$amount = other.amount;
    if (l$amount != lOther$amount) {
      return false;
    }
    final l$participants = participants;
    final lOther$participants = other.participants;
    if (_$data.containsKey('participants') !=
        other._$data.containsKey('participants')) {
      return false;
    }
    if (l$participants != null && lOther$participants != null) {
      if (l$participants.length != lOther$participants.length) {
        return false;
      }
      for (int i = 0; i < l$participants.length; i++) {
        final l$participants$entry = l$participants[i];
        final lOther$participants$entry = lOther$participants[i];
        if (l$participants$entry != lOther$participants$entry) {
          return false;
        }
      }
    } else if (l$participants != lOther$participants) {
      return false;
    }
    final l$description = description;
    final lOther$description = other.description;
    if (_$data.containsKey('description') !=
        other._$data.containsKey('description')) {
      return false;
    }
    if (l$description != lOther$description) {
      return false;
    }
    return true;
  }

  @override
  int get hashCode {
    final l$title = title;
    final l$date = date;
    final l$location = location;
    final l$amount = amount;
    final l$participants = participants;
    final l$description = description;
    return Object.hashAll([
      _$data.containsKey('title') ? l$title : const {},
      l$date,
      _$data.containsKey('location') ? l$location : const {},
      l$amount,
      _$data.containsKey('participants')
          ? l$participants == null
              ? null
              : Object.hashAll(l$participants.map((v) => v))
          : const {},
      _$data.containsKey('description') ? l$description : const {},
    ]);
  }
}

abstract class CopyWith$Input$CreateEventRequestInput<TRes> {
  factory CopyWith$Input$CreateEventRequestInput(
    Input$CreateEventRequestInput instance,
    TRes Function(Input$CreateEventRequestInput) then,
  ) = _CopyWithImpl$Input$CreateEventRequestInput;

  factory CopyWith$Input$CreateEventRequestInput.stub(TRes res) =
      _CopyWithStubImpl$Input$CreateEventRequestInput;

  TRes call({
    String? title,
    String? date,
    String? location,
    int? amount,
    List<Input$CreateParticipantRequestInput?>? participants,
    String? description,
  });
  TRes participants(
      Iterable<Input$CreateParticipantRequestInput?>? Function(
              Iterable<
                  CopyWith$Input$CreateParticipantRequestInput<
                      Input$CreateParticipantRequestInput>?>?)
          _fn);
}

class _CopyWithImpl$Input$CreateEventRequestInput<TRes>
    implements CopyWith$Input$CreateEventRequestInput<TRes> {
  _CopyWithImpl$Input$CreateEventRequestInput(
    this._instance,
    this._then,
  );

  final Input$CreateEventRequestInput _instance;

  final TRes Function(Input$CreateEventRequestInput) _then;

  static const _undefined = <dynamic, dynamic>{};

  TRes call({
    Object? title = _undefined,
    Object? date = _undefined,
    Object? location = _undefined,
    Object? amount = _undefined,
    Object? participants = _undefined,
    Object? description = _undefined,
  }) =>
      _then(Input$CreateEventRequestInput._({
        ..._instance._$data,
        if (title != _undefined) 'title': (title as String?),
        if (date != _undefined && date != null) 'date': (date as String),
        if (location != _undefined) 'location': (location as String?),
        if (amount != _undefined && amount != null) 'amount': (amount as int),
        if (participants != _undefined)
          'participants':
              (participants as List<Input$CreateParticipantRequestInput?>?),
        if (description != _undefined) 'description': (description as String?),
      }));

  TRes participants(
          Iterable<Input$CreateParticipantRequestInput?>? Function(
                  Iterable<
                      CopyWith$Input$CreateParticipantRequestInput<
                          Input$CreateParticipantRequestInput>?>?)
              _fn) =>
      call(
          participants: _fn(_instance.participants?.map((e) => e == null
              ? null
              : CopyWith$Input$CreateParticipantRequestInput(
                  e,
                  (i) => i,
                )))?.toList());
}

class _CopyWithStubImpl$Input$CreateEventRequestInput<TRes>
    implements CopyWith$Input$CreateEventRequestInput<TRes> {
  _CopyWithStubImpl$Input$CreateEventRequestInput(this._res);

  TRes _res;

  call({
    String? title,
    String? date,
    String? location,
    int? amount,
    List<Input$CreateParticipantRequestInput?>? participants,
    String? description,
  }) =>
      _res;

  participants(_fn) => _res;
}

class Input$ParticipantInput {
  factory Input$ParticipantInput({
    required String id,
    String? name,
    String? email,
    required bool isHost,
  }) =>
      Input$ParticipantInput._({
        r'id': id,
        if (name != null) r'name': name,
        if (email != null) r'email': email,
        r'isHost': isHost,
      });

  Input$ParticipantInput._(this._$data);

  factory Input$ParticipantInput.fromJson(Map<String, dynamic> data) {
    final result$data = <String, dynamic>{};
    final l$id = data['id'];
    result$data['id'] = (l$id as String);
    if (data.containsKey('name')) {
      final l$name = data['name'];
      result$data['name'] = (l$name as String?);
    }
    if (data.containsKey('email')) {
      final l$email = data['email'];
      result$data['email'] = (l$email as String?);
    }
    final l$isHost = data['isHost'];
    result$data['isHost'] = (l$isHost as bool);
    return Input$ParticipantInput._(result$data);
  }

  Map<String, dynamic> _$data;

  String get id => (_$data['id'] as String);

  String? get name => (_$data['name'] as String?);

  String? get email => (_$data['email'] as String?);

  bool get isHost => (_$data['isHost'] as bool);

  Map<String, dynamic> toJson() {
    final result$data = <String, dynamic>{};
    final l$id = id;
    result$data['id'] = l$id;
    if (_$data.containsKey('name')) {
      final l$name = name;
      result$data['name'] = l$name;
    }
    if (_$data.containsKey('email')) {
      final l$email = email;
      result$data['email'] = l$email;
    }
    final l$isHost = isHost;
    result$data['isHost'] = l$isHost;
    return result$data;
  }

  CopyWith$Input$ParticipantInput<Input$ParticipantInput> get copyWith =>
      CopyWith$Input$ParticipantInput(
        this,
        (i) => i,
      );

  @override
  bool operator ==(Object other) {
    if (identical(this, other)) {
      return true;
    }
    if (!(other is Input$ParticipantInput) ||
        runtimeType != other.runtimeType) {
      return false;
    }
    final l$id = id;
    final lOther$id = other.id;
    if (l$id != lOther$id) {
      return false;
    }
    final l$name = name;
    final lOther$name = other.name;
    if (_$data.containsKey('name') != other._$data.containsKey('name')) {
      return false;
    }
    if (l$name != lOther$name) {
      return false;
    }
    final l$email = email;
    final lOther$email = other.email;
    if (_$data.containsKey('email') != other._$data.containsKey('email')) {
      return false;
    }
    if (l$email != lOther$email) {
      return false;
    }
    final l$isHost = isHost;
    final lOther$isHost = other.isHost;
    if (l$isHost != lOther$isHost) {
      return false;
    }
    return true;
  }

  @override
  int get hashCode {
    final l$id = id;
    final l$name = name;
    final l$email = email;
    final l$isHost = isHost;
    return Object.hashAll([
      l$id,
      _$data.containsKey('name') ? l$name : const {},
      _$data.containsKey('email') ? l$email : const {},
      l$isHost,
    ]);
  }
}

abstract class CopyWith$Input$ParticipantInput<TRes> {
  factory CopyWith$Input$ParticipantInput(
    Input$ParticipantInput instance,
    TRes Function(Input$ParticipantInput) then,
  ) = _CopyWithImpl$Input$ParticipantInput;

  factory CopyWith$Input$ParticipantInput.stub(TRes res) =
      _CopyWithStubImpl$Input$ParticipantInput;

  TRes call({
    String? id,
    String? name,
    String? email,
    bool? isHost,
  });
}

class _CopyWithImpl$Input$ParticipantInput<TRes>
    implements CopyWith$Input$ParticipantInput<TRes> {
  _CopyWithImpl$Input$ParticipantInput(
    this._instance,
    this._then,
  );

  final Input$ParticipantInput _instance;

  final TRes Function(Input$ParticipantInput) _then;

  static const _undefined = <dynamic, dynamic>{};

  TRes call({
    Object? id = _undefined,
    Object? name = _undefined,
    Object? email = _undefined,
    Object? isHost = _undefined,
  }) =>
      _then(Input$ParticipantInput._({
        ..._instance._$data,
        if (id != _undefined && id != null) 'id': (id as String),
        if (name != _undefined) 'name': (name as String?),
        if (email != _undefined) 'email': (email as String?),
        if (isHost != _undefined && isHost != null) 'isHost': (isHost as bool),
      }));
}

class _CopyWithStubImpl$Input$ParticipantInput<TRes>
    implements CopyWith$Input$ParticipantInput<TRes> {
  _CopyWithStubImpl$Input$ParticipantInput(this._res);

  TRes _res;

  call({
    String? id,
    String? name,
    String? email,
    bool? isHost,
  }) =>
      _res;
}

class Input$CreateParticipantRequestInput {
  factory Input$CreateParticipantRequestInput({
    String? name,
    String? email,
    required bool isHost,
  }) =>
      Input$CreateParticipantRequestInput._({
        if (name != null) r'name': name,
        if (email != null) r'email': email,
        r'isHost': isHost,
      });

  Input$CreateParticipantRequestInput._(this._$data);

  factory Input$CreateParticipantRequestInput.fromJson(
      Map<String, dynamic> data) {
    final result$data = <String, dynamic>{};
    if (data.containsKey('name')) {
      final l$name = data['name'];
      result$data['name'] = (l$name as String?);
    }
    if (data.containsKey('email')) {
      final l$email = data['email'];
      result$data['email'] = (l$email as String?);
    }
    final l$isHost = data['isHost'];
    result$data['isHost'] = (l$isHost as bool);
    return Input$CreateParticipantRequestInput._(result$data);
  }

  Map<String, dynamic> _$data;

  String? get name => (_$data['name'] as String?);

  String? get email => (_$data['email'] as String?);

  bool get isHost => (_$data['isHost'] as bool);

  Map<String, dynamic> toJson() {
    final result$data = <String, dynamic>{};
    if (_$data.containsKey('name')) {
      final l$name = name;
      result$data['name'] = l$name;
    }
    if (_$data.containsKey('email')) {
      final l$email = email;
      result$data['email'] = l$email;
    }
    final l$isHost = isHost;
    result$data['isHost'] = l$isHost;
    return result$data;
  }

  CopyWith$Input$CreateParticipantRequestInput<
          Input$CreateParticipantRequestInput>
      get copyWith => CopyWith$Input$CreateParticipantRequestInput(
            this,
            (i) => i,
          );

  @override
  bool operator ==(Object other) {
    if (identical(this, other)) {
      return true;
    }
    if (!(other is Input$CreateParticipantRequestInput) ||
        runtimeType != other.runtimeType) {
      return false;
    }
    final l$name = name;
    final lOther$name = other.name;
    if (_$data.containsKey('name') != other._$data.containsKey('name')) {
      return false;
    }
    if (l$name != lOther$name) {
      return false;
    }
    final l$email = email;
    final lOther$email = other.email;
    if (_$data.containsKey('email') != other._$data.containsKey('email')) {
      return false;
    }
    if (l$email != lOther$email) {
      return false;
    }
    final l$isHost = isHost;
    final lOther$isHost = other.isHost;
    if (l$isHost != lOther$isHost) {
      return false;
    }
    return true;
  }

  @override
  int get hashCode {
    final l$name = name;
    final l$email = email;
    final l$isHost = isHost;
    return Object.hashAll([
      _$data.containsKey('name') ? l$name : const {},
      _$data.containsKey('email') ? l$email : const {},
      l$isHost,
    ]);
  }
}

abstract class CopyWith$Input$CreateParticipantRequestInput<TRes> {
  factory CopyWith$Input$CreateParticipantRequestInput(
    Input$CreateParticipantRequestInput instance,
    TRes Function(Input$CreateParticipantRequestInput) then,
  ) = _CopyWithImpl$Input$CreateParticipantRequestInput;

  factory CopyWith$Input$CreateParticipantRequestInput.stub(TRes res) =
      _CopyWithStubImpl$Input$CreateParticipantRequestInput;

  TRes call({
    String? name,
    String? email,
    bool? isHost,
  });
}

class _CopyWithImpl$Input$CreateParticipantRequestInput<TRes>
    implements CopyWith$Input$CreateParticipantRequestInput<TRes> {
  _CopyWithImpl$Input$CreateParticipantRequestInput(
    this._instance,
    this._then,
  );

  final Input$CreateParticipantRequestInput _instance;

  final TRes Function(Input$CreateParticipantRequestInput) _then;

  static const _undefined = <dynamic, dynamic>{};

  TRes call({
    Object? name = _undefined,
    Object? email = _undefined,
    Object? isHost = _undefined,
  }) =>
      _then(Input$CreateParticipantRequestInput._({
        ..._instance._$data,
        if (name != _undefined) 'name': (name as String?),
        if (email != _undefined) 'email': (email as String?),
        if (isHost != _undefined && isHost != null) 'isHost': (isHost as bool),
      }));
}

class _CopyWithStubImpl$Input$CreateParticipantRequestInput<TRes>
    implements CopyWith$Input$CreateParticipantRequestInput<TRes> {
  _CopyWithStubImpl$Input$CreateParticipantRequestInput(this._res);

  TRes _res;

  call({
    String? name,
    String? email,
    bool? isHost,
  }) =>
      _res;
}

enum Enum$__TypeKind {
  SCALAR,
  OBJECT,
  INTERFACE,
  UNION,
  ENUM,
  INPUT_OBJECT,
  LIST,
  NON_NULL,
  $unknown
}

String toJson$Enum$__TypeKind(Enum$__TypeKind e) {
  switch (e) {
    case Enum$__TypeKind.SCALAR:
      return r'SCALAR';
    case Enum$__TypeKind.OBJECT:
      return r'OBJECT';
    case Enum$__TypeKind.INTERFACE:
      return r'INTERFACE';
    case Enum$__TypeKind.UNION:
      return r'UNION';
    case Enum$__TypeKind.ENUM:
      return r'ENUM';
    case Enum$__TypeKind.INPUT_OBJECT:
      return r'INPUT_OBJECT';
    case Enum$__TypeKind.LIST:
      return r'LIST';
    case Enum$__TypeKind.NON_NULL:
      return r'NON_NULL';
    case Enum$__TypeKind.$unknown:
      return r'$unknown';
  }
}

Enum$__TypeKind fromJson$Enum$__TypeKind(String value) {
  switch (value) {
    case r'SCALAR':
      return Enum$__TypeKind.SCALAR;
    case r'OBJECT':
      return Enum$__TypeKind.OBJECT;
    case r'INTERFACE':
      return Enum$__TypeKind.INTERFACE;
    case r'UNION':
      return Enum$__TypeKind.UNION;
    case r'ENUM':
      return Enum$__TypeKind.ENUM;
    case r'INPUT_OBJECT':
      return Enum$__TypeKind.INPUT_OBJECT;
    case r'LIST':
      return Enum$__TypeKind.LIST;
    case r'NON_NULL':
      return Enum$__TypeKind.NON_NULL;
    default:
      return Enum$__TypeKind.$unknown;
  }
}

enum Enum$__DirectiveLocation {
  QUERY,
  MUTATION,
  SUBSCRIPTION,
  FIELD,
  FRAGMENT_DEFINITION,
  FRAGMENT_SPREAD,
  INLINE_FRAGMENT,
  VARIABLE_DEFINITION,
  SCHEMA,
  SCALAR,
  OBJECT,
  FIELD_DEFINITION,
  ARGUMENT_DEFINITION,
  INTERFACE,
  UNION,
  ENUM,
  ENUM_VALUE,
  INPUT_OBJECT,
  INPUT_FIELD_DEFINITION,
  $unknown
}

String toJson$Enum$__DirectiveLocation(Enum$__DirectiveLocation e) {
  switch (e) {
    case Enum$__DirectiveLocation.QUERY:
      return r'QUERY';
    case Enum$__DirectiveLocation.MUTATION:
      return r'MUTATION';
    case Enum$__DirectiveLocation.SUBSCRIPTION:
      return r'SUBSCRIPTION';
    case Enum$__DirectiveLocation.FIELD:
      return r'FIELD';
    case Enum$__DirectiveLocation.FRAGMENT_DEFINITION:
      return r'FRAGMENT_DEFINITION';
    case Enum$__DirectiveLocation.FRAGMENT_SPREAD:
      return r'FRAGMENT_SPREAD';
    case Enum$__DirectiveLocation.INLINE_FRAGMENT:
      return r'INLINE_FRAGMENT';
    case Enum$__DirectiveLocation.VARIABLE_DEFINITION:
      return r'VARIABLE_DEFINITION';
    case Enum$__DirectiveLocation.SCHEMA:
      return r'SCHEMA';
    case Enum$__DirectiveLocation.SCALAR:
      return r'SCALAR';
    case Enum$__DirectiveLocation.OBJECT:
      return r'OBJECT';
    case Enum$__DirectiveLocation.FIELD_DEFINITION:
      return r'FIELD_DEFINITION';
    case Enum$__DirectiveLocation.ARGUMENT_DEFINITION:
      return r'ARGUMENT_DEFINITION';
    case Enum$__DirectiveLocation.INTERFACE:
      return r'INTERFACE';
    case Enum$__DirectiveLocation.UNION:
      return r'UNION';
    case Enum$__DirectiveLocation.ENUM:
      return r'ENUM';
    case Enum$__DirectiveLocation.ENUM_VALUE:
      return r'ENUM_VALUE';
    case Enum$__DirectiveLocation.INPUT_OBJECT:
      return r'INPUT_OBJECT';
    case Enum$__DirectiveLocation.INPUT_FIELD_DEFINITION:
      return r'INPUT_FIELD_DEFINITION';
    case Enum$__DirectiveLocation.$unknown:
      return r'$unknown';
  }
}

Enum$__DirectiveLocation fromJson$Enum$__DirectiveLocation(String value) {
  switch (value) {
    case r'QUERY':
      return Enum$__DirectiveLocation.QUERY;
    case r'MUTATION':
      return Enum$__DirectiveLocation.MUTATION;
    case r'SUBSCRIPTION':
      return Enum$__DirectiveLocation.SUBSCRIPTION;
    case r'FIELD':
      return Enum$__DirectiveLocation.FIELD;
    case r'FRAGMENT_DEFINITION':
      return Enum$__DirectiveLocation.FRAGMENT_DEFINITION;
    case r'FRAGMENT_SPREAD':
      return Enum$__DirectiveLocation.FRAGMENT_SPREAD;
    case r'INLINE_FRAGMENT':
      return Enum$__DirectiveLocation.INLINE_FRAGMENT;
    case r'VARIABLE_DEFINITION':
      return Enum$__DirectiveLocation.VARIABLE_DEFINITION;
    case r'SCHEMA':
      return Enum$__DirectiveLocation.SCHEMA;
    case r'SCALAR':
      return Enum$__DirectiveLocation.SCALAR;
    case r'OBJECT':
      return Enum$__DirectiveLocation.OBJECT;
    case r'FIELD_DEFINITION':
      return Enum$__DirectiveLocation.FIELD_DEFINITION;
    case r'ARGUMENT_DEFINITION':
      return Enum$__DirectiveLocation.ARGUMENT_DEFINITION;
    case r'INTERFACE':
      return Enum$__DirectiveLocation.INTERFACE;
    case r'UNION':
      return Enum$__DirectiveLocation.UNION;
    case r'ENUM':
      return Enum$__DirectiveLocation.ENUM;
    case r'ENUM_VALUE':
      return Enum$__DirectiveLocation.ENUM_VALUE;
    case r'INPUT_OBJECT':
      return Enum$__DirectiveLocation.INPUT_OBJECT;
    case r'INPUT_FIELD_DEFINITION':
      return Enum$__DirectiveLocation.INPUT_FIELD_DEFINITION;
    default:
      return Enum$__DirectiveLocation.$unknown;
  }
}

const possibleTypesMap = <String, Set<String>>{};

I have also this query file:

query {
    myEvents {
      id,
      title,
      date,
      location,
      amount,
      participants {
        id,
        email,
        name,
        isHost
      },
      description
    }
}

That generates a pretty much empty dart file.

nachoarreola commented 1 year ago

In the generated dart file, you can notice that raw Event (not EventInput) and Participant are missing.

nachoarreola commented 1 year ago

Also, any plans for supporting DateTime?

budde377 commented 12 months ago

Can you provide an example of why did you like this better?

This blog post might give some background on why I created the generator.

I have also this query file:

Please add a name to the query and see if it helps.

In the generated dart file, you can notice that raw Event (not EventInput) and Participant are missing.

We can not generate any meaningful types for type because they are not available client-side and, therefore, will never be instantiated. Think of the following case:


type Node {
  parent: Node!
}

The type would be something like

class Node {
  final Node parent;
}

Because the parent is a non-nullable self-reference we can never instantiate it. Instead, the API will always return a selection of fields on a type, which is what we are generating.

Also, any plans for supporting DateTime?

You can configure any scalars as you see fit. Please see the documentation here.

budde377 commented 11 months ago

Closing this for now, let me know if you have more questions.