diff options
Diffstat (limited to 'src/orchestrator/api/projecthandler.go')
-rw-r--r-- | src/orchestrator/api/projecthandler.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/orchestrator/api/projecthandler.go b/src/orchestrator/api/projecthandler.go index 83211b64..6b512804 100644 --- a/src/orchestrator/api/projecthandler.go +++ b/src/orchestrator/api/projecthandler.go @@ -21,9 +21,9 @@ import ( "io" "net/http" - moduleLib "github.com/onap/multicloud-k8s/src/orchestrator/pkg/module" - "github.com/gorilla/mux" + "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/validation" + moduleLib "github.com/onap/multicloud-k8s/src/orchestrator/pkg/module" ) // Used to store backend implementations objects @@ -47,10 +47,11 @@ func (h projectHandler) createHandler(w http.ResponseWriter, r *http.Request) { http.Error(w, err.Error(), http.StatusUnprocessableEntity) return } - - // Name is required. - if p.MetaData.Name == "" { - http.Error(w, "Missing name in POST request", http.StatusBadRequest) + jsonFile := "json-schemas/metadata.json" + // Verify JSON Body + err, httpError := validation.ValidateJsonSchemaData(jsonFile, p) + if err != nil { + http.Error(w, err.Error(), httpError) return } |