summaryrefslogtreecommitdiffstats
path: root/src/ncm/api/providernethandler.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/ncm/api/providernethandler.go')
-rw-r--r--src/ncm/api/providernethandler.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ncm/api/providernethandler.go b/src/ncm/api/providernethandler.go
index 66a41a4d..48d5d7ea 100644
--- a/src/ncm/api/providernethandler.go
+++ b/src/ncm/api/providernethandler.go
@@ -31,6 +31,8 @@ import (
"github.com/gorilla/mux"
)
+var pnetJSONFile string = "json-schemas/provider-network.json"
+
// Used to store backend implementations objects
// Also simplifies mocking for unit testing purposes
type providernetHandler struct {
@@ -139,6 +141,12 @@ func (h providernetHandler) createProviderNetHandler(w http.ResponseWriter, r *h
return
}
+ err, httpError := validation.ValidateJsonSchemaData(pnetJSONFile, p)
+if err != nil {
+ http.Error(w, err.Error(), httpError)
+ return
+}
+
// Name is required.
if p.Metadata.Name == "" {
http.Error(w, "Missing name in POST request", http.StatusBadRequest)