-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some basic docs on the new config file
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
linkTitle: Configuration | ||
title: How to configure gqlgen using gqlgen.yml | ||
description: How to configure gqlgen using gqlgen.yml | ||
menu: main | ||
weight: -7 | ||
--- | ||
|
||
gqlgen can be configured using a `gqlgen.yml` file, by default it will be loaded from the current directory, or any parent directory. | ||
|
||
Example: | ||
```yml | ||
schema: schema.graphql | ||
|
||
# Let gqlgen know where to put the generated server | ||
exec: | ||
filename: graph/generated/generated.go | ||
package: generated | ||
|
||
# Let gqlgen know where to the generated models (if any) | ||
model: | ||
filename: models/generated.go | ||
package: models | ||
|
||
# Tell gqlgen about any existing models you want to reuse for | ||
# graphql. These normally come from the db or a remote api. | ||
models: | ||
User: | ||
model: github.com/my/app/models.User | ||
Todo: | ||
model: github.com/my/app/models.Todo | ||
fields: | ||
id: | ||
resolver: true # force a resolver to be generated | ||
``` | ||
Everything has defaults, so add things as you need. | ||