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

Function LoadSchema

graphql/test/test.go:26–37  ·  view source on GitHub ↗

Various helpers used in GQL testing LoadSchema parses and validates the given schema string and requires no errors.

(t *testing.T, gqlSchema string)

Source from the content-addressed store, hash-verified

24// LoadSchema parses and validates the given schema string and requires
25// no errors.
26func LoadSchema(t *testing.T, gqlSchema string) schema.Schema {
27
28 doc, gqlErr := parser.ParseSchemas(validator.Prelude, &ast.Source{Input: gqlSchema})
29 requireNoGQLErrors(t, gqlErr)
30
31 gql, gqlErr := validator.ValidateSchemaDocument(doc)
32 requireNoGQLErrors(t, gqlErr)
33
34 schema, err := schema.AsSchema(gql, x.RootNamespace)
35 requireNoGQLErrors(t, err)
36 return schema
37}
38
39// LoadSchemaFromFile reads a graphql schema file as would be the initial schema
40// definition. It runs all validation, generates the completed schema and

Callers 1

LoadSchemaFromStringFunction · 0.85

Calls 2

AsSchemaFunction · 0.92
requireNoGQLErrorsFunction · 0.85

Tested by

no test coverage detected