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

Function schemaValidateHandler

dgraph/cmd/alpha/admin.go:82–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80}
81
82func schemaValidateHandler() http.Handler {
83 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
84 sch := readRequest(w, r)
85 w.Header().Set("Content-Type", "application/json")
86
87 err := admin.SchemaValidate(string(sch))
88 if err == nil {
89 w.WriteHeader(http.StatusOK)
90 x.SetStatus(w, "success", "Schema is valid")
91 return
92 }
93
94 w.WriteHeader(http.StatusBadRequest)
95 errs := strings.Split(strings.TrimSpace(err.Error()), "\n")
96 x.SetStatusWithErrors(w, x.ErrorInvalidRequest, errs)
97 })
98}
99
100func drainingHandler(w http.ResponseWriter, r *http.Request) {
101 enableStr := r.URL.Query().Get("enable")

Callers 1

getAdminMuxFunction · 0.85

Calls 7

SchemaValidateFunction · 0.92
SetStatusFunction · 0.92
SetStatusWithErrorsFunction · 0.92
readRequestFunction · 0.85
SetMethod · 0.65
WriteHeaderMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected