-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgqlgen.yml
More file actions
119 lines (114 loc) · 4.1 KB
/
Copy pathgqlgen.yml
File metadata and controls
119 lines (114 loc) · 4.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# gqlgen configuration for the Lunar GraphQL API.
#
# The GraphQL schema (internal/graph/schema/*.graphqls) is the source of truth.
# Running `mise run generate-graphql` (go tool gqlgen generate) regenerates the
# executable schema, models, and resolver stubs. Because resolvers are generated
# as Go interfaces, the compiler refuses to build until every schema field has an
# implementation — so the API can never silently drift from the schema.
schema:
- internal/graph/schema/*.graphqls
# Where the generated executable schema (the runtime) is written.
exec:
filename: internal/graph/generated.go
package: graph
# Where models that have no hand-written/bound Go type are generated. Types bound
# in the `models:` section below (or owned elsewhere in the codebase) are NOT
# regenerated here.
model:
filename: internal/graph/model/models_gen.go
package: model
# Resolvers are generated one file per schema file (follow-schema). The root
# Resolver struct lives in internal/graph/resolver.go (hand-written, holds deps).
resolver:
layout: follow-schema
dir: internal/graph
package: graph
filename_template: "{name}.resolvers.go"
# Generate value slices ([]T) instead of pointer slices ([]*T) for list fields,
# which matches how the store package returns value-type slices.
omit_slice_element_pointers: true
# Bind GraphQL types to the existing domain types in internal/store so resolvers
# return store values directly instead of mapping to duplicate DTOs.
models:
ID:
model:
- github.com/99designs/gqlgen/graphql.ID
- github.com/99designs/gqlgen/graphql.Int
Int:
model:
- github.com/99designs/gqlgen/graphql.Int
- github.com/99designs/gqlgen/graphql.Int64
Map:
model: github.com/dimiro1/lunar/internal/graph/model.StringMap
Function:
model: github.com/dimiro1/lunar/internal/store.FunctionWithActiveVersion
fields:
# Relation/derived fields resolved lazily from the store, so only queries
# that select them do the work (env/KV are the original overfetch fix;
# versions/executions/nextRun are graph-traversal edges).
versions:
resolver: true
executions:
resolver: true
nextRun:
resolver: true
metrics:
resolver: true
envVars:
resolver: true
scopedData:
resolver: true
globalData:
resolver: true
# The store carries cron_status as *string; a field resolver coerces it to
# the CronStatus enum (mapping an empty/absent value to null).
cronStatus:
resolver: true
FunctionVersion:
model: github.com/dimiro1/lunar/internal/store.FunctionVersion
fields:
# Reverse edge back to the owning function.
function:
resolver: true
PageInfo:
model: github.com/dimiro1/lunar/internal/store.PaginationInfo
Execution:
model: github.com/dimiro1/lunar/internal/store.Execution
fields:
# Relation edges resolved from the execution's foreign keys / id, all lazy.
function:
resolver: true
version:
resolver: true
logs:
resolver: true
aiRequests:
resolver: true
emailRequests:
resolver: true
AIRequest:
model: github.com/dimiro1/lunar/internal/store.AIRequest
fields:
execution:
resolver: true
EmailRequest:
model: github.com/dimiro1/lunar/internal/store.EmailRequest
fields:
execution:
resolver: true
APIToken:
model: github.com/dimiro1/lunar/internal/store.APIToken
# Enums bound to the existing store string types, so resolvers return store
# values directly. The GraphQL enum values match the store constant strings.
CronStatus:
model: github.com/dimiro1/lunar/internal/store.CronStatus
Language:
model: github.com/dimiro1/lunar/internal/store.Language
ExecutionStatus:
model: github.com/dimiro1/lunar/internal/store.ExecutionStatus
ExecutionTrigger:
model: github.com/dimiro1/lunar/internal/store.ExecutionTrigger
AIRequestStatus:
model: github.com/dimiro1/lunar/internal/store.AIRequestStatus
EmailRequestStatus:
model: github.com/dimiro1/lunar/internal/store.EmailRequestStatus