Best way to implement namespace?
- Dominant language
- Go
- Stars
- 10.8k
- Forks
- 1.3k
- Avg merge
- 2d 36m
- Merged PRs (30d)
- 26
Description
### 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
```graphql
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
Contributor guide
Research direction
Look at how gqlgen handles directives and field generation, especially the @goField directive. Examine the codegen process in the codegen package and the gqlgen.yml configuration. The goal is to design a @namespace directive that simplifies the schema and reduces resolver boilerplate for namespaced operations. Start by understanding the existing directive system and how it integrates with the GraphQL schema parsing and code generation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, graphql
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100