Skip to content

Feature Request: Write typeDefs and resolvers together #1125

Answered by xialvjun
xialvjun asked this question in General
Discussion options

You must be logged in to vote

If posssible, hope it can generate types, args: gql.Person.books.args:

const schema: { typeDefs: any, resolvers: any } = gql`
type Person {
  _id: ID! ${async (root, args, ctx, info) => {
    return root._id;
  }}
  name: String!
  books(name_like: String!): [Book!]! ${async (root, args: gql.Person.books.args, ctx, info) => {
    return db.manyOrNone(`select * from book where person_id=? and name like ?`, [root._id, args.name_like]);
  }}
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ardatan
Comment options

Answer selected by ardatan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1125 on May 22, 2020 21:59.