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

Function missingChild

script/ghmock/schemacmd.go:424–434  ·  view source on GitHub ↗
(ref *openapi3.SchemaRef, walked, seg string)

Source from the content-addressed store, hash-verified

422}
423
424func missingChild(ref *openapi3.SchemaRef, walked, seg string) error {
425 place := where(walked)
426 if ref.Value != nil && ref.Value.Items != nil {
427 return fmt.Errorf("%s is a list; put an index first, such as %s.0.%s", place, place, seg)
428 }
429 names := propertyNames(ref.Value)
430 if len(names) == 0 {
431 return fmt.Errorf("%s (%s) has nothing inside it", place, describeSchemaType(ref))
432 }
433 return notFound(fmt.Sprintf("%s has no property named %s", place, seg), seg, names)
434}
435
436// describeSchemaType names the JSON a schema allows, such as "string or null"
437// or "object (simple-user)".

Callers 1

schemaAtFunction · 0.85

Calls 5

whereFunction · 0.85
propertyNamesFunction · 0.85
describeSchemaTypeFunction · 0.85
notFoundFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected