99designs / 99designs/gqlgen

[Proposal] Resolve the schema location from where the config file live instead of the current working dir

Open
#2,857 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
10.8k
Forks
1.3k
Avg merge
2d 36m
Merged PRs (30d)
26

Description

### What happened?

Currently, codegen cli resolves schema paths from the current working dir where the codegen cli is running which makes it confusing when defining the location of the schema in the config file.

For example, if we have a folder structure like this:

```
.
├── __gqlgen__
│ ├── config.yml
│ └── schema.gql
└── generator.go
```

```go
// generator.go

package generator

//go:generate go run github.com/99designs/gqlgen --config ./__gqlgen__/config.yml
```

You need to set the path of the schema in the config file like this which is weird and confusing.

```yml
# __gqlgen__/config.yml

schema: ./__gqlgen__/schema.gql
```

### What did you expect?

Since the codegen cli doesn't have flags for the schema location I think that the location of the schema can be resolve from the location where the config file is living instead of the current working dir where the codegen cli is running.

### versions
- `gqlgen` v0.17.41
- `go` v1.21.4

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.