Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
merge operationconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
srinandan committed May 24, 2021
1 parent a1138b9 commit d2b4327
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions client/products/products.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,6 @@ func updateProduct(productSettings ProductSettings) (respBody []byte, err error)
p.Environments = append(p.Environments, productSettings.Environments...)
}

//TODO: Merge groups...

if len(productSettings.OperationGrp) > 0 {
err = json.Unmarshal(productSettings.OperationGrp, OperationGroup)
if err != nil {
Expand All @@ -374,7 +372,11 @@ func updateProduct(productSettings ProductSettings) (respBody []byte, err error)
if reflect.DeepEqual(*OperationGroup, operationGroup{}) {
return nil, fmt.Errorf("can't unmarshal json to OperationGroup")
}
p.OperationGroup = OperationGroup
//check to see the operation config type is the same
if OperationGroup.OperationConfigType != p.OperationGroup.OperationConfigType {
return nil, fmt.Errorf("updated operationConfigType must match the existing operationConfigType - ", OperationGroup.OperationConfigType)
}
p.OperationGroup.OperationConfigs = append(p.OperationGroup.OperationConfigs, OperationGroup.OperationConfigs...)
}

if len(productSettings.GqlOperationGrp) > 0 {
Expand All @@ -386,7 +388,11 @@ func updateProduct(productSettings ProductSettings) (respBody []byte, err error)
if reflect.DeepEqual(*GraphqlOperationGroup, graphqlOperationGroup{}) {
return nil, fmt.Errorf("can't unmarshal json to GraphqlOperationGroup")
}
p.GraphQLOperationGroup = GraphqlOperationGroup
//check to see the operation config type is the same
if GraphqlOperationGroup.OperationConfigType != p.GraphQLOperationGroup.OperationConfigType {
return nil, fmt.Errorf("updated operationConfigType must match the existing operationConfigType - ", GraphqlOperationGroup.OperationConfigType)
}
p.GraphQLOperationGroup.OperationConfigs = append(p.GraphQLOperationGroup.OperationConfigs, GraphqlOperationGroup.OperationConfigs...)
}

if len(productSettings.Proxies) > 0 {
Expand Down

0 comments on commit d2b4327

Please sign in to comment.