MCPcopy Create free account
hub / github.com/cli/cli / requireSchemas

Function requireSchemas

script/ghmock/scaffold.go:142–157  ·  view source on GitHub ↗

requireSchemas loads the schemas that scaffolding the targets needs. Unlike checks, scaffolding can't go ahead without them.

(chk *checker, targets []string, responses responseSet)

Source from the content-addressed store, hash-verified

140// requireSchemas loads the schemas that scaffolding the targets needs. Unlike
141// checks, scaffolding can't go ahead without them.
142func requireSchemas(chk *checker, targets []string, responses responseSet) error {
143 for _, name := range targets {
144 method, target, _ := strings.Cut(name, " ")
145 switch {
146 case method == "graphql":
147 if _, err := chk.graphQL(); err != nil {
148 return fmt.Errorf("scaffolding needs GitHub's GraphQL schema: %w", err)
149 }
150 case strings.HasPrefix(target, "/") && len(responses[name]) == 0:
151 if _, err := chk.rest(); err != nil {
152 return fmt.Errorf("scaffolding needs GitHub's REST description: %w", err)
153 }
154 }
155 }
156 return nil
157}
158
159// sentQuery is a GraphQL query gh sent, with its variables.
160type sentQuery struct {

Callers 1

cmdScaffoldFunction · 0.85

Calls 3

graphQLMethod · 0.80
restMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected