File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,6 +92,6 @@ type CreateNode struct {
9292 Type NodeType `json:"type" binding:"required"`
9393 Product AddProduct `json:"product" binding:"required"`
9494 ProviderConfig * ProviderCloudConfig `json:"providerConfig" binding:"required_if=Type cloud"`
95- PhysicalPortID * uuid.UUID `json:"physicalPortId,omitempty" binding:"required_if=Type access" `
96- Vlan int64 `json:"vlan,omitempty" binding:"required_if=Type access" `
95+ PhysicalPortID * uuid.UUID `json:"physicalPortId,omitempty"`
96+ Vlan int64 `json:"vlan,omitempty"`
9797}
Original file line number Diff line number Diff line change @@ -1305,36 +1305,4 @@ func TestCreateAccessNodeFailedValidator(t *testing.T) {
13051305
13061306 g .Expect (err .Error ()).Should (Equal ("Key: 'CreateNode.Product.SKU' Error:Field validation for 'SKU' failed on the 'required' tag" ))
13071307 g .Expect (data ).Should (BeNil ())
1308-
1309- data , err = cli .CreateNode (
1310- context .Background (),
1311- models.CreateNode {
1312- Name : "node_name" ,
1313- Type : models .NodeTypeAccess ,
1314- Product : models.AddProduct {
1315- SKU : "CEQUFR5100AWS" ,
1316- },
1317- Vlan : 2 ,
1318- },
1319- workspaceID ,
1320- )
1321-
1322- g .Expect (err .Error ()).Should (Equal ("Key: 'CreateNode.PhysicalPortID' Error:Field validation for 'PhysicalPortID' failed on the 'required_if' tag" ))
1323- g .Expect (data ).Should (BeNil ())
1324-
1325- data , err = cli .CreateNode (
1326- context .Background (),
1327- models.CreateNode {
1328- Name : "node_name" ,
1329- Type : models .NodeTypeAccess ,
1330- Product : models.AddProduct {
1331- SKU : "CEQUFR5100AWS" ,
1332- },
1333- PhysicalPortID : & physicalPortId ,
1334- },
1335- workspaceID ,
1336- )
1337-
1338- g .Expect (err .Error ()).Should (Equal ("Key: 'CreateNode.Vlan' Error:Field validation for 'Vlan' failed on the 'required_if' tag" ))
1339- g .Expect (data ).Should (BeNil ())
13401308}
You can’t perform that action at this time.
0 commit comments