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

Function nullability

script/ghmock/schemacmd.go:185–204  ·  view source on GitHub ↗

nullability says whether a field's value can be null, or for input fields, whether the field is required.

(t *ast.Type, input bool)

Source from the content-addressed store, hash-verified

183// nullability says whether a field's value can be null, or for input fields,
184// whether the field is required.
185func nullability(t *ast.Type, input bool) string {
186 if input {
187 if t.NonNull {
188 return "Required."
189 }
190 return "Optional."
191 }
192 s := "Can be null."
193 if t.NonNull {
194 s = "Never null."
195 }
196 if t.Elem != nil {
197 if t.Elem.NonNull {
198 s += " Items are never null."
199 } else {
200 s += " Items can be null."
201 }
202 }
203 return s
204}
205
206func kindLabel(k ast.DefinitionKind) string {
207 switch k {

Callers 1

writeGraphQLFieldFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected