Skip to content

Commit

Permalink
Fix bug: integer cannot be null (#496)
Browse files Browse the repository at this point in the history
* Fix bug: integer cannot be null

* Refactor method name
  • Loading branch information
habara-k authored Oct 30, 2024
1 parent 3695195 commit 2bab995
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,18 @@ public Object execute(Map<String, Object> args, PebbleTemplate self, EvaluationC
// such as imageBackgroundColor in ButtonsTemplate.
return true;
}
if (var.isInteger && isGreaterThanZero(var.minimum)) {
// For optional integer types with a minimum value greater than 0,
// it's acceptable to treat 0 as a null value
return true;
}
if (var.isPrimitiveType) {
return false;
}
return true;
}

private boolean isGreaterThanZero(String val) {
return val != null && Integer.parseInt(val) > 0;
}
}
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Limit struct {
* The maximum number of narrowcast messages to send. Use this parameter to limit the number of narrowcast messages sent. The recipients will be chosen at random.
* minimum: 1
*/
Max int32 `json:"max"`
Max int32 `json:"max,omitempty"`

/**
* If true, the message will be sent within the maximum number of deliverable messages. The default value is `false`. Targets will be selected at random.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ type ShowLoadingAnimationRequest struct {
* minimum: 5
* maximum: 60
*/
LoadingSeconds int32 `json:"loadingSeconds"`
LoadingSeconds int32 `json:"loadingSeconds,omitempty"`
}

0 comments on commit 2bab995

Please sign in to comment.