MCPcopy
hub / github.com/dgraph-io/dgraph / lambdaDirectiveValidation

Function lambdaDirectiveValidation

graphql/schema/rules.go:1415–1435  ·  view source on GitHub ↗
(sch *ast.Schema,
	typ *ast.Definition,
	field *ast.FieldDefinition,
	dir *ast.Directive,
	secrets map[string]x.Sensitive)

Source from the content-addressed store, hash-verified

1413}
1414
1415func lambdaDirectiveValidation(sch *ast.Schema,
1416 typ *ast.Definition,
1417 field *ast.FieldDefinition,
1418 dir *ast.Directive,
1419 secrets map[string]x.Sensitive) gqlerror.List {
1420 // if the lambda url wasn't specified during alpha startup,
1421 // just return that error. Don't confuse the user with errors from @custom yet.
1422 if x.LambdaUrl(x.RootNamespace) == "" {
1423 return []*gqlerror.Error{gqlerror.ErrorPosf(dir.Position,
1424 "Type %s; Field %s: has the @lambda directive, but the "+
1425 `--graphql "lambda-url=...;" flag wasn't specified during alpha startup.`,
1426 typ.Name, field.Name)}
1427 }
1428 // reuse @custom directive validation
1429 errs := customDirectiveValidation(sch, typ, field, buildCustomDirectiveForLambda(typ, field,
1430 dir, x.RootNamespace, func(f *ast.FieldDefinition) bool { return false }), secrets)
1431 for _, err := range errs {
1432 err.Message = "While building @custom for @lambda: " + err.Message
1433 }
1434 return errs
1435}
1436
1437// defaultDirectiveValidation will prevents use of @default on:
1438// Types with @remote directive

Callers

nothing calls this directly

Calls 3

LambdaUrlFunction · 0.92

Tested by

no test coverage detected