Skip to content

Commit

Permalink
Update auto generated go snappi
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Sep 18, 2023
1 parent 3319af7 commit dcb8dac
Show file tree
Hide file tree
Showing 6 changed files with 1,405 additions and 377 deletions.
52 changes: 25 additions & 27 deletions gosnappi/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ type httpClient struct {
// All methods that perform validation will add errors here
// All api rpcs MUST call Validate
type Constraints interface {
ValueOf(name string) interface{}
Warnings() []string
}

type validation struct {
Expand Down Expand Up @@ -428,34 +428,32 @@ func (obj *validation) validateHexSlice(hex []string) error {
return obj.validateSlice(hex, "hex")
}

// TODO: restore behavior
// func (obj *validation) createMap(objName string) {
// if obj.constraints == nil {
// obj.constraints = make(map[string]map[string]Constraints)
// }
// _, ok := obj.constraints[objName]
// if !ok {
// obj.constraints[objName] = make(map[string]Constraints)
// }
// }
func (obj *validation) createMap(objName string) {
if obj.constraints == nil {
obj.constraints = make(map[string]map[string]Constraints)
}
_, ok := obj.constraints[objName]
if !ok {
obj.constraints[objName] = make(map[string]Constraints)
}
}

// TODO: restore behavior
// func (obj *validation) isUnique(objectName, value string, object Constraints) bool {
// if value == "" {
// return true
// }
func (obj *validation) isUnique(objectName, value string, scope string, object Constraints) bool {
if value == "" {
return true
}

// obj.createMap("globals")
// _, ok := obj.constraints["globals"][value]
// unique := false
// if !ok {
// obj.constraints["globals"][value] = object
// obj.createMap(objectName)
// obj.constraints[objectName][value] = object
// unique = true
// }
// return unique
// }
obj.createMap(scope)
_, ok := obj.constraints[scope][value]
unique := false
if !ok {
obj.constraints[scope][value] = object
// obj.createMap(objectName)
// obj.constraints[objectName][value] = object
unique = true
}
return unique
}

// TODO: restore behavior
// func (obj *validation) validateConstraint(objectName []string, value string) bool {
Expand Down
2 changes: 1 addition & 1 deletion gosnappi/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ require (
github.com/ghodss/yaml v1.0.0
github.com/gorilla/mux v1.8.0
github.com/stretchr/testify v1.8.4
google.golang.org/grpc v1.58.0
google.golang.org/grpc v1.58.1
google.golang.org/protobuf v1.31.0
)
4 changes: 2 additions & 2 deletions gosnappi/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1665,8 +1665,8 @@ google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwS
google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g=
google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o=
google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
google.golang.org/grpc v1.58.1 h1:OL+Vz23DTtrrldqHK49FUOPHyY75rvFqJfXC84NYW58=
google.golang.org/grpc v1.58.1/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
Expand Down
Loading

0 comments on commit dcb8dac

Please sign in to comment.