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

Function isA

script/ghmock/graphqlcheck.go:300–314  ·  view source on GitHub ↗

isA reports whether an object of type concrete is also of type name, which can be the same type, an interface it implements or a union it belongs to.

(schema *ast.Schema, concrete *ast.Definition, name string)

Source from the content-addressed store, hash-verified

298// isA reports whether an object of type concrete is also of type name, which
299// can be the same type, an interface it implements or a union it belongs to.
300func isA(schema *ast.Schema, concrete *ast.Definition, name string) bool {
301 if concrete.Name == name {
302 return true
303 }
304 def := schema.Types[name]
305 if def == nil {
306 return false
307 }
308 for _, t := range schema.GetPossibleTypes(def) {
309 if t.Name == concrete.Name {
310 return true
311 }
312 }
313 return false
314}
315
316func (w *gqlWalker) checkObject(path string, obj map[string]any, def *ast.Definition, sel ast.SelectionSet, required bool) {
317 concrete := def

Callers 3

appliesMethod · 0.85
appliesMethod · 0.85
isAMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected