Skip to content
This repository was archived by the owner on Dec 27, 2024. It is now read-only.

Commit 0411638

Browse files
authored
fix: bad func used for nullattributeisoneof and fix description (#60)
1 parent ebda76a commit 0411638

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

boolvalidator/null_if_attribute_is_one_of.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
// NullIfAttributeIsOneOf checks if the path.Path attribute contains
1212
// one of the exceptedValue attr.Value.
1313
func NullIfAttributeIsOneOf(path path.Expression, exceptedValue []attr.Value) validator.Int64 {
14-
return internal.RequireIfAttributeIsOneOf{
14+
return internal.NullIfAttributeIsOneOf{
1515
PathExpression: path,
1616
ExceptedValues: exceptedValue,
1717
}

int64validator/null_if_attribute_is_one_of.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
// NullIfAttributeIsOneOf checks if the path.Path attribute contains
1212
// one of the exceptedValue attr.Value.
1313
func NullIfAttributeIsOneOf(path path.Expression, exceptedValue []attr.Value) validator.Int64 {
14-
return internal.RequireIfAttributeIsOneOf{
14+
return internal.NullIfAttributeIsOneOf{
1515
PathExpression: path,
1616
ExceptedValues: exceptedValue,
1717
}

internal/null_if_attribute_is_one_of.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ func (av NullIfAttributeIsOneOf) Description(_ context.Context) string {
4646
var expectedValueDescritpion string
4747
for i, expectedValue := range av.ExceptedValues {
4848
if i == len(av.ExceptedValues)-1 {
49-
expectedValueDescritpion += expectedValue.String()
49+
expectedValueDescritpion += fmt.Sprintf("%s, ", expectedValue.String())
5050
break
5151
}
5252
expectedValueDescritpion += expectedValue.String()
5353
}
54-
return fmt.Sprintf("If %s attribute is set and the value is one of %s, this attribute is null", av.PathExpression, expectedValueDescritpion)
54+
return fmt.Sprintf("If %s attribute is set and the value is one of %s, this attribute is NULL", av.PathExpression, expectedValueDescritpion)
5555
}
5656

5757
func (av NullIfAttributeIsOneOf) MarkdownDescription(_ context.Context) string {
@@ -63,7 +63,7 @@ func (av NullIfAttributeIsOneOf) MarkdownDescription(_ context.Context) string {
6363
}
6464
expectedValueDescritpion += fmt.Sprintf("`%s`, ", expectedValue)
6565
}
66-
return fmt.Sprintf("If %s attribute is set and the value is one of %s, this attribute is null", av.PathExpression, expectedValueDescritpion)
66+
return fmt.Sprintf("If %s attribute is set and the value is one of %s, this attribute is NULL", av.PathExpression, expectedValueDescritpion)
6767
}
6868

6969
func (av NullIfAttributeIsOneOf) Validate(ctx context.Context, req NullIfAttributeIsOneOfRequest, res *NullIfAttributeIsOneOfResponse) {

internal/require_if_attribute_is_one_of.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ func (av RequireIfAttributeIsOneOf) Description(_ context.Context) string {
4646
var expectedValueDescritpion string
4747
for i, expectedValue := range av.ExceptedValues {
4848
if i == len(av.ExceptedValues)-1 {
49-
expectedValueDescritpion += expectedValue.String()
49+
expectedValueDescritpion += fmt.Sprintf("%s, ", expectedValue.String())
5050
break
5151
}
5252
expectedValueDescritpion += expectedValue.String()
5353
}
54-
return fmt.Sprintf("If %s attribute is set and the value is one of %s, this attribute is required", av.PathExpression, expectedValueDescritpion)
54+
return fmt.Sprintf("If %s attribute is set and the value is one of %s, this attribute is REQUIRED", av.PathExpression, expectedValueDescritpion)
5555
}
5656

5757
func (av RequireIfAttributeIsOneOf) MarkdownDescription(_ context.Context) string {
@@ -63,7 +63,7 @@ func (av RequireIfAttributeIsOneOf) MarkdownDescription(_ context.Context) strin
6363
}
6464
expectedValueDescritpion += fmt.Sprintf("`%s`, ", expectedValue)
6565
}
66-
return fmt.Sprintf("If %s attribute is set and the value is one of %s, this attribute is required", av.PathExpression, expectedValueDescritpion)
66+
return fmt.Sprintf("If %s attribute is set and the value is one of %s, this attribute is REQUIRED", av.PathExpression, expectedValueDescritpion)
6767
}
6868

6969
func (av RequireIfAttributeIsOneOf) Validate(ctx context.Context, req RequireIfAttributeIsOneOfRequest, res *RequireIfAttributeIsOneOfResponse) {

listvalidator/null_if_attribute_is_one_of.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
// NullIfAttributeIsOneOf checks if the path.Path attribute contains
1212
// one of the exceptedValue attr.Value.
1313
func NullIfAttributeIsOneOf(path path.Expression, exceptedValue []attr.Value) validator.List {
14-
return internal.RequireIfAttributeIsOneOf{
14+
return internal.NullIfAttributeIsOneOf{
1515
PathExpression: path,
1616
ExceptedValues: exceptedValue,
1717
}

mapvalidator/null_if_attribute_is_one_of.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
// NullIfAttributeIsOneOf checks if the path.Path attribute contains
1212
// one of the exceptedValue attr.Value.
1313
func NullIfAttributeIsOneOf(path path.Expression, exceptedValue []attr.Value) validator.Map {
14-
return internal.RequireIfAttributeIsOneOf{
14+
return internal.NullIfAttributeIsOneOf{
1515
PathExpression: path,
1616
ExceptedValues: exceptedValue,
1717
}

setvalidator/null_if_attribute_is_one_of.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
// NullIfAttributeIsOneOf checks if the path.Path attribute contains
1212
// one of the exceptedValue attr.Value.
1313
func NullIfAttributeIsOneOf(path path.Expression, exceptedValue []attr.Value) validator.Set {
14-
return internal.RequireIfAttributeIsOneOf{
14+
return internal.NullIfAttributeIsOneOf{
1515
PathExpression: path,
1616
ExceptedValues: exceptedValue,
1717
}

stringvalidator/null_if_attribute_is_one_of.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
// NullIfAttributeIsOneOf checks if the path.Path attribute contains
1212
// one of the exceptedValue attr.Value.
1313
func NullIfAttributeIsOneOf(path path.Expression, exceptedValue []attr.Value) validator.String {
14-
return internal.RequireIfAttributeIsOneOf{
14+
return internal.NullIfAttributeIsOneOf{
1515
PathExpression: path,
1616
ExceptedValues: exceptedValue,
1717
}

0 commit comments

Comments
 (0)