Generated resolver go files are not going into sub packages using `follow-schema`
- Dominant language
- Go
- Stars
- 10.8k
- Forks
- 1.3k
- Avg merge
- 2d 36m
- Merged PRs (30d)
- 26
Description
Hi there,
### What happened?
I have my `.graphql` files organised into sub-directories, eg `company`, `user` etc
```
server/schema/
company/
company.queries.graphql
company.mutations.graphql
user/
user.queries.graphql
user.mutations.graphql
```
Though I am using `follow-schema` option (see below) to generate resolvers, generated resolver go files are not being organised into sub packages (under `resolver` package). Instead all of them are put directly into main resolver directory.
```
server/resolver/
company.queries.go
company.mutations.go
user.queries.go
user.mutations.go
resolver.go
```
Here is my `gqlgen.yml`
```
# Where are all the schema files located? globs are supported eg src/**/*.graphqls
schema:
- server/schema/**/*.graphql
# Where should the generated server code go?
exec:
filename: server/generated/generated.go
package: generated
# Uncomment to enable federation
# federation:
# filename: server/generated/federation.go
# package: generated
# Where should any generated models go?
model:
filename: server/model/models_gen.go
package: model
# Where should the resolver implementations go?
resolver:
layout: follow-schema
dir: server/resolver
package: resolver
# Optional: turn on use ` + "`" + `gqlgen:"fieldName"` + "`" + ` tags in your models
# struct_tag: json
# Optional: turn on to use []Thing instead of []*Thing
# omit_slice_element_pointers: false
# Optional: set to speed up generation time by not performing a final validation pass.
# skip_validation: true
# gqlgen will search for any type names in the schema in these go packages
# if they match it will use them, otherwise it will generate them.
autobind:
- "github.com///server/types"
# This section declares type mapping between the GraphQL and go type systems
#
# The first line in each type will be used as defaults for resolver arguments and
# modelgen, the others will be allowed when binding to fields. Configure them to
# your liking
models:
ID:
model:
- github.com/99designs/gqlgen/graphql.ID
- github.com/99designs/gqlgen/graphql.Int
- github.com/99designs/gqlgen/graphql.Int64
- github.com/99designs/gqlgen/graphql.Int32
Int:
model:
- github.com/99designs/gqlgen/graphql.Int
- github.com/99designs/gqlgen/graphql.Int64
- github.com/99designs/gqlgen/graphql.Int32
```
### What did you expect?
Generated resolver go files organised into sub-packages
```
server/resolver/
company/
company.queries.go
company.mutations.go
user/
user.queries.go
user.mutations.go
resolver.go
```
### Minimal graphql.schema and models to reproduce
Nothing to do with schema and model I believe. Can be reproduced with any two or more `.graphql` files organised into sub-directories.
### versions
- `go run github.com/99designs/gqlgen version`: v0.17.2
- `go version`: 1.18
Contributor guide
Assessment
This issue has not been assessed yet.