@onichandame/type-graphql-tag

0.1.0 • Public • Published

Type Graphql Tag

Example Usage

import {Field,Type,createSchema} from '@onichandame/type-graphql-tag'

class User {
  @Field()
  name!:string
}

@Type(`PostComment`)
class Comment{
  @Field()
  text!:string
}

class Post {
@Field()
author!:User
  @Field({[Comment]})
  comments!:Comment[]
}

class PostAddCommentsInput{
  @Field({type:()=>[Comment]})
  comments: Comment[]
}

const schema=createSchema({operation:`mutation`,endpoint:`addComments`,output:Post,input:PostAddCommentsInput})
/* Same as below
const schema = gql`
  mutation ($comments: [PostCommentInput]){
    addComments (comments: $comments){
      author {
        name
        comments {
          text
        }
      }
    }
  }
`
*/

Package Sidebar

Install

npm i @onichandame/type-graphql-tag

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

19 kB

Total Files

55

Last publish

Collaborators

  • onichandame