expression method

Expression expression()

Implementation

Expression expression() {
  return refer(
    isInput
        ? 'inputObjectType<$typeName${_typeList()}>'
        : 'objectType<$typeName${_typeList()}>',
  ).call(
    [refer('__name')],
    {
      if (!isInput) 'isInterface': literalBool(isInterface),
      if (!isInput) 'interfaces': literalList(interfaces),
      if (isInput && inputConfig!.oneOf == true) 'isOneOf': literalBool(true),
      if (description != null && description!.isNotEmpty)
        'description': refer("'${description!}'"),
      if (attachments != null)
        'extra': refer('GraphQLTypeDefinitionExtra.attach').call([
          refer(attachments!),
        ])
    },
  );
}