summaryrefslogtreecommitdiffstats
path: root/src/orchestrator/api/add_intents_handler.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/orchestrator/api/add_intents_handler.go')
-rw-r--r--src/orchestrator/api/add_intents_handler.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/orchestrator/api/add_intents_handler.go b/src/orchestrator/api/add_intents_handler.go
index ac8b400d..21a33739 100644
--- a/src/orchestrator/api/add_intents_handler.go
+++ b/src/orchestrator/api/add_intents_handler.go
@@ -31,6 +31,7 @@ type intentHandler struct {
client moduleLib.IntentManager
}
+// Add Intent in Deployment Group
func (h intentHandler) addIntentHandler(w http.ResponseWriter, r *http.Request) {
var i moduleLib.Intent
@@ -45,8 +46,11 @@ func (h intentHandler) addIntentHandler(w http.ResponseWriter, r *http.Request)
return
}
- if i.MetaData.Name == "" {
- http.Error(w, "Missing Intent in POST request", http.StatusBadRequest)
+ jsonFile := "json-schemas/deployment-intent.json"
+ // Verify JSON Body
+ err, httpError := validation.ValidateJsonSchemaData(jsonFile, i)
+ if err != nil {
+ http.Error(w, err.Error(), httpError)
return
}