Skip to content

Commit e65a621

Browse files
committed
Moved validateExactlyOneAttribute and validateAtLeastOneAttribute back to their old positions as requested by review in helper/schema/schema.go
1 parent e193bdb commit e65a621

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

helper/schema/schema.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,16 @@ func (m schemaMap) validate(
14001400
ok = raw != nil
14011401
}
14021402

1403+
err := validateExactlyOneAttribute(k, schema, c)
1404+
if err != nil {
1405+
return nil, []error{err}
1406+
}
1407+
1408+
err = validateAtLeastOneAttribute(k, schema, c)
1409+
if err != nil {
1410+
return nil, []error{err}
1411+
}
1412+
14031413
if !ok {
14041414
if schema.Required {
14051415
return nil, []error{fmt.Errorf(
@@ -1414,17 +1424,7 @@ func (m schemaMap) validate(
14141424
"%q: this field cannot be set", k)}
14151425
}
14161426

1417-
err := validateRequiredWithAttribute(k, schema, c)
1418-
if err != nil {
1419-
return nil, []error{err}
1420-
}
1421-
1422-
err = validateExactlyOneAttribute(k, schema, c)
1423-
if err != nil {
1424-
return nil, []error{err}
1425-
}
1426-
1427-
err = validateAtLeastOneAttribute(k, schema, c)
1427+
err = validateRequiredWithAttribute(k, schema, c)
14281428
if err != nil {
14291429
return nil, []error{err}
14301430
}

helper/schema/schema_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6537,7 +6537,7 @@ func TestValidateAtLeastOneOfAttributes(t *testing.T) {
65376537
},
65386538

65396539
Config: map[string]interface{}{},
6540-
Err: false,
6540+
Err: true,
65416541
},
65426542

65436543
"Only Unknown Variable Value": {

0 commit comments

Comments
 (0)