summaryrefslogtreecommitdiffstats
path: root/src/ovnaction/api/workloadintenthandler.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/ovnaction/api/workloadintenthandler.go')
-rw-r--r--src/ovnaction/api/workloadintenthandler.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ovnaction/api/workloadintenthandler.go b/src/ovnaction/api/workloadintenthandler.go
index cf7ecebc..acf4edbb 100644
--- a/src/ovnaction/api/workloadintenthandler.go
+++ b/src/ovnaction/api/workloadintenthandler.go
@@ -29,6 +29,8 @@ import (
"github.com/gorilla/mux"
)
+var workloadIntJSONFile string = "json-schemas/network-workload.json"
+
// Used to store backend implementations objects
// Also simplifies mocking for unit testing purposes
type workloadintentHandler struct {
@@ -82,6 +84,12 @@ func (h workloadintentHandler) createHandler(w http.ResponseWriter, r *http.Requ
return
}
+ err, httpError := validation.ValidateJsonSchemaData(workloadIntJSONFile, wi)
+if err != nil {
+ http.Error(w, err.Error(), httpError)
+ return
+}
+
// Name is required.
if wi.Metadata.Name == "" {
http.Error(w, "Missing name in POST request", http.StatusBadRequest)