Skip to content

Bug: Type "XxxxxxxFilter" not found in document #114

Description

@davidsparkles

Package

  • db
  • schema-builder

Describe the bug

In the example below, Project has a relation to ProjectComment for the field comments. Because comments is decorated with QueryPermissions the schema-builder generates the SDL for the subquery for ProjectComment naming the ProjectCommentFilter as type for the optional where parameter of the subquery. Since ProjectComment does not have a decorator for QueryPermissions or MutationPermissions, it does not create the SDL type ProjectCommentFilter leading to the error, shown below.

Solution: Either withdraw the QueryPermissions from comments or give ProjectComment permissions.

To Reproduce

@Entity()
export default class Project extends BaseEntity {
  @PrimaryGeneratedColumn()
  public readonly id!: string;

  @Column({ type: "varchar", gqlType: "String", nullable: true })
  public comment!: string;

  @OneToMany((type) => ProjectComment, "project")
  @QueryPermissions(anyone())
  public comments!: ProjectComment[];
}

@Entity()
export default class ProjectComment extends BaseEntity {
  @PrimaryGeneratedColumn()
  public readonly id!: string;

  @Column({ type: "varchar", gqlType: "String", nullable: true })
  public comment!: string;

  @ManyToOne((type) => Project, "comments")
  public project!: Project;
}
one:b624d9:BootLoader:error 2019-08-07T17:34:34+0300 <error> index.js:80 (BootLoader.<anonymous>) BootLoader.boot.error.caught: Error: Type "ProjectCommentFilter" not found in document.

Expected behavior

To be discussed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions