Menu

#151 "Cannot determine GraphQL input type" on filter using RelationshipField, when the target entity class name does not match the name provided in its ObjectType()

open
nobody
None
2023-08-22
2023-08-22
Anonymous
No

Originally created by: kyelewis

Describe the bug
When decorating a field with RelationshipField, if the target of the relationship has a different name in its type-graphql ObjectType decorator from its .name property, the backend will fail with:

**To Reproduce**
Create two entities in this form:

@ObjectType("One")
class EntityOne {
...
}

@ObjectType()
class EntityTwo {
@RelationshipField(() => EntityOne, { id: 'entityOneId' })
entityOne!: EntityOne;
}

The base resolver will create a filter `OnesFilter` using the name from the ObjectType decorator.
The RelationshipField decorator will attempt to create a filter field using the type name `EntityOnesFilter` from the class name.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB