diff options
author | 2020-08-21 00:11:26 +0000 | |
---|---|---|
committer | 2020-08-21 00:11:26 +0000 | |
commit | 38ed3fbf85636ad5f73538c2de07cce72499f5bf (patch) | |
tree | 0b0df9525e67e0180c00abaa078d07fc9b5d9e08 /src/orchestrator/api/deployment_intent_groups_handler.go | |
parent | a5ffa8aadf49bb92371f06797b264e0bf4c264e2 (diff) | |
parent | 6fc3a329aba55dfa2d4867bde9d8a3126b45f59a (diff) |
Merge "Add Validation for API's"
Diffstat (limited to 'src/orchestrator/api/deployment_intent_groups_handler.go')
-rw-r--r-- | src/orchestrator/api/deployment_intent_groups_handler.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/orchestrator/api/deployment_intent_groups_handler.go b/src/orchestrator/api/deployment_intent_groups_handler.go index 7620737b..76dea14c 100644 --- a/src/orchestrator/api/deployment_intent_groups_handler.go +++ b/src/orchestrator/api/deployment_intent_groups_handler.go @@ -21,8 +21,8 @@ import ( "io" "net/http" - moduleLib "github.com/onap/multicloud-k8s/src/orchestrator/pkg/module" "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/validation" + moduleLib "github.com/onap/multicloud-k8s/src/orchestrator/pkg/module" "github.com/gorilla/mux" ) @@ -49,8 +49,11 @@ func (h deploymentIntentGroupHandler) createDeploymentIntentGroupHandler(w http. return } - if d.MetaData.Name == "" { - http.Error(w, "Missing deploymentIntentGroupName in POST request", http.StatusBadRequest) + jsonFile := "json-schemas/deployment-group-intent.json" + // Verify JSON Body + err, httpError := validation.ValidateJsonSchemaData(jsonFile, d) + if err != nil { + http.Error(w, err.Error(), httpError) return } |