Cannot determine a GraphQL input type for the "eq". Make sure your class is decorated with an appropriate decorator.

See original GitHub issue

Describe the bug Cursor position on object with only one attribute that leads to another nested object That lead to error: Cannot determine a GraphQL input type for the “eq”. Make sure your class is decorated with an appropriate decorator.

Have you read the Contributing Guidelines?

yes

To Reproduce Steps to reproduce the behavior:

  1. create

@ObjectType('PositionProfile', {  })
@Schema({collection: 'positionProfile', timestamps: { createdAt: 'created', updatedAt: 'updated' } })
@CursorConnection('careerLevels', () => CareerLevel)
export class PositionProfile {
  __typename?: 'PositionProfile';

  @Prop()
  @IDField(() => String)
  _id: string;

  @FilterableField()
  @Prop()
  profileName!: string;

  @Prop({ type: [CareerLevelSchema]})
  careerLevels!: Array<CareerLevel>;

and

import {Field, ObjectType} from '@nestjs/graphql';
import {Id, IdSchema} from '../id/id.model';
import {Prop, Schema, SchemaFactory} from '@nestjs/mongoose';
import {FilterableField} from '@nestjs-query/query-graphql';
import {Document} from 'mongoose';

@ObjectType({  })
@Schema()
export class CareerLevel {
  __typename?: 'CareerLevel';

  @FilterableField(_type => Id, { nullable: true })
  @Prop({type: IdSchema})
  id!: Id;
}

export interface CareerLevel extends Document {}
export type CareerLevelDocument = CareerLevel & Document;
export const CareerLevelSchema = SchemaFactory.createForClass(CareerLevel);

Expected behavior Not to throw that error on nested objects

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
MikeMatrixcommented, Oct 8, 2021

@lukasender Sadly no, ended up designing my structure differently to avoid having to use this setup all together.

0reactions
sudomfcommented, Apr 7, 2022

Hey guys. Looks like the ManyToMany and OneToMany relations didn’t pop the relations types when you use the DTO for a custom Filter for example.

Given the DTO:

@FilterableOffsetConnection('subTasks', () => SubTaskDTO)
class TodoItemDTO {
  @FilterableField()
  description!: string;
}

I can create a Filter using the description field:

const filter: Filter<TodoItemDTO> = {
  description: { eq: "foo" }
};

But I can’t create a filter using the subTasks relation:

const filter: Filter<TodoItemDTO> = {
  subTasks: { id: { in: ["123", "321"] } } // TS Error: Property 'subTasks' does not exist on type 'Filter<TodoItemDTO>'.ts(2339)
};

Is there any way to ensure the relations types?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot determine a GraphQL input type, while using Nestjs + ...
@xadm the input type is a class called User. I still cant see the problem. Would it be okay if you can guide...
Read more >
type-graphql/Lobby - Gitter
I'm receiving CannotDetermineGraphQLTypeError: Cannot determine GraphQL input type for 'support' of 'CreateDeviceRequest' class. Does the value used as its ...
Read more >
Resolvers | NestJS - A progressive Node.js framework
Most of the definitions in a GraphQL schema are object types. Each object type you define should represent a domain object that an...
Read more >
Authorization | Nestjs-query - Blog
The nestjs-query graphql package exposes decorators and options to allow the ... if you can determine at that point that the user should...
Read more >
graphql variable of type x was not provided - You.com
The first userID should be id instead of userID, it should also be defined as id in the Apollo server to match your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found