@hydre/make_schema

1.3.0 • Public • Published

@hydre/make_schema

An utility function to build a graphql schema

const schema = make_schema({
  document: 'type Query { ping: String! }',
  resolvers: {
    Query: {
      ping: () => 'pong',
    },
    Subscription: {
      ping: {
        resolve: () => 'pong',
        async *subscribe() {
          yield 0
        },
      },
    },
  },
  directives: {
    foo: ({
      resolve, // original resolver
      root, // resolver params in the same order
      parameters, // .
      context, // .
      info, // .
      directive_arguments, // parameters for the directive
    }) => {},
  },
})

Readme

Keywords

Package Sidebar

Install

npm i @hydre/make_schema

Weekly Downloads

1

Version

1.3.0

License

UNLICENSE

Unpacked Size

9.17 kB

Total Files

8

Last publish

Collaborators

  • sceat
  • hydre-bot
  • deltaevo