Skip to content

Commit

Permalink
update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
ms-henglu committed Mar 1, 2024
1 parent 8744484 commit d706a85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v1.13.0 (unreleased)
ENHANCEMENTS:
- Support the new bicep types.

## v1.12.0
ENHANCEMENTS:
- `azapi_resource` resource: Support `ignore_body_changes` property.
Expand Down
8 changes: 4 additions & 4 deletions internal/azure/types/array_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ var _ TypeBase = &ArrayType{}
type ArrayType struct {
Type string `json:"$type"`
ItemType *TypeReference `json:"itemType"`
MinLength int `json:"minLength"`
MaxLength int `json:"maxLength"`
MinLength *int `json:"minLength"`
MaxLength *int `json:"maxLength"`
}

func (t *ArrayType) GetWriteOnly(body interface{}) interface{} {
Expand Down Expand Up @@ -55,11 +55,11 @@ func (t *ArrayType) Validate(body interface{}, path string) []error {
}

// check the length
if len(bodyArray) < t.MinLength {
if t.MinLength != nil && len(bodyArray) < *t.MinLength {
errors = append(errors, utils.ErrorCommon(path, fmt.Sprintf("array length is less than %d", t.MinLength)))
}

if len(bodyArray) > t.MaxLength {
if t.MaxLength != nil && len(bodyArray) > *t.MaxLength {
errors = append(errors, utils.ErrorCommon(path, fmt.Sprintf("array length is greater than %d", t.MaxLength)))
}

Expand Down

0 comments on commit d706a85

Please sign in to comment.