github.com/bowd/gqlgen@v0.7.2/docs/content/config.md (about) 1 --- 2 linkTitle: Configuration 3 title: How to configure gqlgen using gqlgen.yml 4 description: How to configure gqlgen using gqlgen.yml 5 menu: main 6 weight: -7 7 --- 8 9 gqlgen can be configured using a `gqlgen.yml` file, by default it will be loaded from the current directory, or any parent directory. 10 11 Example: 12 ```yml 13 # You can pass a single schema file 14 schema: schema.graphql 15 16 # Or multiple files 17 schema: 18 - schema.graphql 19 - user.graphql 20 21 # Or you can use globs 22 schema: 23 - "*.graphql" 24 25 # Let gqlgen know where to put the generated server 26 exec: 27 filename: graph/generated/generated.go 28 package: generated 29 30 # Let gqlgen know where to put the generated models (if any) 31 model: 32 filename: models/generated.go 33 package: models 34 35 # Optional, turns on resolver stub generation 36 resolver: 37 filename: resolver.go # where to write them 38 type: Resolver # what's the resolver root implementation type called? 39 40 # Optional, turns on binding to field names by tag provided 41 struct_tag: json 42 43 # Tell gqlgen about any existing models you want to reuse for 44 # graphql. These normally come from the db or a remote api. 45 models: 46 User: 47 model: github.com/my/app/models.User 48 Todo: 49 model: github.com/my/app/models.Todo 50 fields: 51 id: 52 resolver: true # force a resolver to be generated 53 fieldName: todoId # bind to a different go field name 54 ``` 55 56 Everything has defaults, so add things as you need. 57