gqlgen icon indicating copy to clipboard operation
gqlgen copied to clipboard

Best way to implement namespace?

Open macnibblet opened this issue 1 year ago • 4 comments

What happened?

Our graphql apis is expanding rapidly and we would like to start namespacing our operations as per https://www.apollographql.com/docs/technotes/TN0012-namespacing-by-separation-of-concern/

What did you expect?

A smooth developer experience without having to add lots of resolvers and complex.

Right now the number of resolvers and extra arguments needed to get this to work as well as gqlgen.yml or @goField tags in confusing to a lot of the engineers.

Maybe we could introduce another internal directive like the goField such as a @namespace that would allow for a better devex.

Minimal graphql.schema and models to reproduce

Given an accounts service

type Query {
  accounts: AccountQueries!
}

type Mutation {
  accounts: AccountMutations!
}

type AccountQueries {
  getById(id: ID!): Account!
}

type AccountMutations {
  create(input: AccountCreateInput!): Account!
}

type Account {
  id: ID!
}

input AccountCreateInput {
  email: String!
}

versions

Not relevant

macnibblet avatar Apr 21 '23 03:04 macnibblet

+1

suryatresna avatar Jun 22 '23 08:06 suryatresna

Any updates on this issues? We are facing the same problem in our project.

danielplappert avatar Jan 11 '24 14:01 danielplappert

+1

abulwcse avatar Apr 15 '24 19:04 abulwcse

+1, I tried namespacing the same way and the generated resolvers do not seem correct.

@macnibblet If you have a full working example (regardless of complexity), I would really like to see it.

SrslyJosh avatar May 15 '24 21:05 SrslyJosh