summaryrefslogtreecommitdiffstats
path: root/src/orchestrator/api/composite_profilehandler.go
diff options
context:
space:
mode:
authorEric Multanen <eric.w.multanen@intel.com>2020-08-21 00:11:26 +0000
committerGerrit Code Review <gerrit@onap.org>2020-08-21 00:11:26 +0000
commit38ed3fbf85636ad5f73538c2de07cce72499f5bf (patch)
tree0b0df9525e67e0180c00abaa078d07fc9b5d9e08 /src/orchestrator/api/composite_profilehandler.go
parenta5ffa8aadf49bb92371f06797b264e0bf4c264e2 (diff)
parent6fc3a329aba55dfa2d4867bde9d8a3126b45f59a (diff)
Merge "Add Validation for API's"
Diffstat (limited to 'src/orchestrator/api/composite_profilehandler.go')
-rw-r--r--src/orchestrator/api/composite_profilehandler.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/orchestrator/api/composite_profilehandler.go b/src/orchestrator/api/composite_profilehandler.go
index 66c64dda..5a3fb19c 100644
--- a/src/orchestrator/api/composite_profilehandler.go
+++ b/src/orchestrator/api/composite_profilehandler.go
@@ -21,6 +21,7 @@ import (
"io"
"net/http"
+ "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/validation"
moduleLib "github.com/onap/multicloud-k8s/src/orchestrator/pkg/module"
"github.com/gorilla/mux"
@@ -48,8 +49,11 @@ func (h compositeProfileHandler) createHandler(w http.ResponseWriter, r *http.Re
return
}
- if cpf.Metadata.Name == "" {
- http.Error(w, "Missing compositeProfileName in POST request", http.StatusBadRequest)
+ jsonFile := "json-schemas/metadata.json"
+ // Verify JSON Body
+ err, httpError := validation.ValidateJsonSchemaData(jsonFile, cpf)
+ if err != nil {
+ http.Error(w, err.Error(), httpError)
return
}