victorteokw/graphql-joker

GraphQL directory structure discussion

Opened this issue · 1 comments

egg-graphql
.
├── app
│ ├── graphql
| | ├── common
| | | └── directive.js // custom directives
│ │ ├── project
│ │ │ └── schema.graphql
│ │ ├── schemaDirectives
│ │ │ └── schemaDirective.js // custom SchemaDirective
│ │ │
│ │ └── user // a GraphQL model
│ │ ├── connector.js
│ │ ├── resolver.js
│ │ └── schema.graphql
│ ├── model
│ │ └── user.js
│ ├── public
│ └── router.js

graphql-joker
.
├── app
│ ├── graphql
| | ├── resolvers
| | | └── User.js
│ │ |── schemas
│ │ │ └── User.gql
├── models
| | └─User.js

Hi @sonong , there are some points on this.

  1. Connector is redundant and should be removed. This creates a layer of unnecessary encapsulation. And this is the main obstacle for coding automatically.
  2. The main discuss is about flat structure or per resource bias.
    1. I personally like flat structure.
    2. Joker is a generic tool. It will definitely support one directory per resource style in the future. Do you like to implement it? For now, it's hard to tweak Joker's behavior to create this style resolver path and schema path.