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)
| 107 | // "types": [ ... ] |
| 108 | // } |
| 109 | func 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 | |
| 127 | func GetInternalPreds(excludeAclPreds bool) string { |
| 128 | if excludeAclPreds { |
no test coverage detected
searching dependent graphs…