99designs / 99designs/gqlgen

Generated resolver go files are not going into sub packages using `follow-schema`

Đang mở
#2,093 10 bình luận 46 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
10.8k
Fork
1.3k
Merge trung bình
2 ngày 36 phút
Pull request đã merge (30 ngày)
26

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.