paljs / prisma-tools

Prisma tools to help you generate CRUD system for GraphQL servers
https://paljs.com
MIT License
684 stars 54 forks source link

GraphQLError: Syntax Error: Expected Name, found "}". #132

Closed ziimakc closed 3 years ago

ziimakc commented 3 years ago

new PrismaSelect(info) gives me error "GraphQLError: Syntax Error: Expected Name, found "}"."

What can be a problem for schema:

const User = objectType({
  name: 'User',
  definition(t) {
    t.int('id')
    t.string('nickname')
  },
})

const Query = objectType({
  name: 'Query',
  definition(t) {
    t.field('findOneUser', {
      type: 'User',
      resolve: async (_parent, _args, ctx, info) => {
        const select = new PrismaSelect(info) // if i delete this line, problem gone

        return { id: 1, nickname: 'a' }
      },
    })
  },
})

And query:

export const FindOneUserQuery = gql`
  query FindOneUser {
    findOneUser {
      id
      nickname
    }
  }

Does prisma database schema can couse a probem, like here: #122

AhmedElywa commented 3 years ago

Can you share your prisma schema, please?

AhmedElywa commented 3 years ago

@ZiiMakc AuthorBook model is many to many relations this one case the issue I will work on this issue today to get a final fix will close this now and you can see updates at #122