MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / GetFullSchemaJSON

Function GetFullSchemaJSON

dgraphapi/schema.go:109–125  ·  view source on GitHub ↗

GetFullSchemaJSON returns a string representation of the JSON object returned by the full schema{} query. It uses the user provided predicates and types along with the initial internal schema to generate the string. Example response looks like: { "schema": [ ... ], "types": [ ... ] }

(opts SchemaOptions)

Source from the content-addressed store, hash-verified

107// "types": [ ... ]
108// }
109func GetFullSchemaJSON(opts SchemaOptions) string {
110 expectedPreds := GetInternalPreds(opts.ExcludeAclSchema)
111 if len(opts.UserPreds) > 0 {
112 expectedPreds += "," + opts.UserPreds
113 }
114
115 expectedTypes := GetInternalTypes(opts.ExcludeAclSchema)
116 if len(opts.UserTypes) > 0 {
117 expectedTypes += "," + opts.UserTypes
118 }
119
120 return fmt.Sprintf(`
121 {
122 "schema": [%s],
123 "types": [%s]
124 }`, expectedPreds, expectedTypes)
125}
126
127func GetInternalPreds(excludeAclPreds bool) string {
128 if excludeAclPreds {

Callers 1

Calls 2

GetInternalPredsFunction · 0.70
GetInternalTypesFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…