From 6fc3a329aba55dfa2d4867bde9d8a3126b45f59a Mon Sep 17 00:00:00 2001 From: Ritu Sood Date: Tue, 4 Aug 2020 14:46:34 -0700 Subject: Add Validation for API's Adding input validations for API based on Json schemas Issue-ID: MULTICLOUD-1096 Signed-off-by: Ritu Sood Change-Id: If6591bdef6305f87cbce7ef56d894376f687c6c1 --- src/orchestrator/api/app_intent_handler.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/orchestrator/api/app_intent_handler.go') diff --git a/src/orchestrator/api/app_intent_handler.go b/src/orchestrator/api/app_intent_handler.go index 56811d2d..a51b9b92 100644 --- a/src/orchestrator/api/app_intent_handler.go +++ b/src/orchestrator/api/app_intent_handler.go @@ -48,8 +48,11 @@ func (h appIntentHandler) createAppIntentHandler(w http.ResponseWriter, r *http. return } - if a.MetaData.Name == "" { - http.Error(w, "Missing AppIntentName in POST request", http.StatusBadRequest) + jsonFile := "json-schemas/generic-placement-intent-app.json" + // Verify JSON Body + err, httpError := validation.ValidateJsonSchemaData(jsonFile, a) + if err != nil { + http.Error(w, err.Error(), httpError) return } -- cgit 1.2.3-korg