Skip to content

HydreIO/make_schema

Repository files navigation

@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
    }) => {},
  },
})

About

An utility function to build a graphql schema

Resources

License

Stars

Watchers

Forks

Packages

No packages published