Gqlgen: feature request: multiple mutation declarations for organization, and combined during generate

Created on 7 Jul 2019  路  2Comments  路  Source: 99designs/gqlgen

What happened?

if I have more than one mutation type, an error is thrown during generation

What did you expect?

It would be nice if we could organize our mutations into separate types and file structure that gets listed under the yml file and then combined during generation. The problem is that in large apps where there are many mutations, the single mutation type gets out of hand and unmanageable very quickly.

Ideally something like

#projects.graphql
type mutation {
  createProject
  updateProject
  deleteProject
}

#users.graphql
type mutation{
  createUser
  updateUser
  deleteUser
}

or any variation of that.

versions

  • gqlgen version? latest
  • go version? 1.12
  • dep or go modules? dep

Most helpful comment

In your schema.graphql

type Query
type Mutation

In your users.graphql

extend type Query {
    findById: User
}

All 2 comments

In your schema.graphql

type Query
type Mutation

In your users.graphql

extend type Query {
    findById: User
}

As @bugzpodder points out, you can do this using type extension

Was this page helpful?
0 / 5 - 0 ratings