0

I have a graphql schema

type Post {
   id: ID! @unique
   createdAt: DateTime!
   updatedAt: DateTime!
   tags:[Tag!]!
}

type Tag {
   id: ID! @unique
   createdAt: DateTime!
   updatedAt: DateTime!
   name: String!
   posts:[Post!]!
}

So, a tag can be applied to many posts and a post can have many tags.

Prisma generates code without any issues, but running a graphql server gives

Error: Unknown type "TagOrderByInput". Did you mean "PostOrderByInput", "UserOrderByInput", "LikeOrderByInput", "TagWhereInput", or "CommentOrderByInput"?
at assertValidSDL (/home/andriy/app/apollo/prisma/node_modules/graphql/validation/validate.js:89:11)

I am using docker with Prisma and Mysql. Is it possible to have such a relationship? If so what I am doing wrong?

Svitlana
  • 2,324
  • 4
  • 22
  • 31

1 Answers1

0

The solution was that in schema.graphql I have imported

# import Post, Query.postsConnection, Post.PostOrderByInput from "./generated- 
schema.graphql"

And by deleting Post.PostOrderByInput the error disappeared.

# import Post, Query.postsConnection from "./generated- 
schema.graphql"
Svitlana
  • 2,324
  • 4
  • 22
  • 31