Skip to content

Commit

Permalink
bugfix: null value can't pass schema validation (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
ms-henglu authored Apr 25, 2024
1 parent 192e61b commit 1bdb8df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v1.13.1

BUG FIXES:
- Fix a bug that `null` value can't pass the schema validation.

## v1.13.0
BREAKING CHANGES:
- Provider field `default_naming_prefix` and `default_naming_suffix` are deprecated. It will not work in this release and will be removed in the next major release.
Expand Down
3 changes: 3 additions & 0 deletions internal/azure/types/integer_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ func (t *IntegerType) AsTypeBase() *TypeBase {
}

func (t *IntegerType) Validate(body interface{}, path string) []error {
if body == nil {
return nil
}
var v int
switch input := body.(type) {
case float64:
Expand Down
3 changes: 3 additions & 0 deletions internal/azure/types/string_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ func (s *StringType) AsTypeBase() *TypeBase {
}

func (s *StringType) Validate(body interface{}, path string) []error {
if body == nil {
return nil
}
v, ok := body.(string)
if !ok {
return []error{utils.ErrorMismatch(path, "string", fmt.Sprintf("%T", body))}
Expand Down

0 comments on commit 1bdb8df

Please sign in to comment.