~bigbes/sr-ht-spec

ref: 4cc9f4338cd63998279198db5ae32a53d9e6f64c sr-ht-spec/graph/generate.go -rw-r--r-- 2.0 KiB
4cc9f433 — Eugene Blikh graph: pin the introspection schema to what the executor can serve a day ago
                                                                                
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
package graph

// Code generation. gqlgen reads gqlgen.yml in this directory and rewrites
// api/generated.go, model/models_gen.go and the stubs in schema.resolvers.go;
// implementations already in that file are carried through untouched.
//
// It is run through the module graph rather than as `go run
// github.com/99designs/gqlgen@v0.17.36`: gqlgen v0.17.36's own module pins
// golang.org/x/tools v0.9.3, which does not compile under this toolchain, while
// the version this module selects does.
//
// Running it that way gets the generator to start, but not to finish: codegen
// is broken here and the module-graph form is not a way around that. gqlgen
// v0.17.36 re-emits an existing resolver's doc comment without its `//`
// markers, so the run ends with `gofmt failed on schema.resolvers.go:
// expected declaration, found It` and leaves that file as invalid Go — revert
// it after any attempt. The bug is fixed upstream: v0.17.94 regenerates this
// package into valid, gofmt-clean Go.
//
// Adopting v0.17.94 is blocked outside this repository, not by the directive
// below. It changes graphql.ExecutableSchema's Complexity method to take a
// context, and sourcecraft.dev/bigbes/sr-ht-core's webhooks/context.go still
// calls the three-argument complexity.Calculate, so the shared library stops
// compiling. spec.sr.ht is the only service of the family that imports
// core-go's webhooks package, which is why the five siblings could move to
// v0.17.94 and this one cannot. The bump belongs in sr-ht-core first; when it
// lands, pin the directive below to the version go.mod then requires, as the
// siblings do.
//
// The generator is deliberately not imported anywhere. A blank import under a
// `generate` build tag — which is how git.sr.ht's api/graph does it — would put
// the whole codegen dependency tree (a CLI framework, a markdown renderer, the
// Go analysis packages) into this service's go.mod permanently, for the sake of
// a tool that runs when the schema changes.
//
//go:generate go run github.com/99designs/gqlgen generate