page_limit config must accept null#833
Conversation
There was a problem hiding this comment.
Pull Request Overview
A concise update to the configuration to allow the "page_limit" setting to accept null values, while ensuring non-null values are valid integers.
- Changed the "page_limit" node from integerNode to scalarNode.
- Added a validation block to enforce that non-null values are integers.
- Commented out normalization code remains, which could be removed if no longer needed.
| #->beforeNormalization() | ||
| #->ifNull() | ||
| #->then(static fn (mixed $v): int => 5) | ||
| #->end() |
There was a problem hiding this comment.
[nitpick] Consider removing or finalizing the commented-out normalization block if it is no longer needed to improve code clarity.
| #->beforeNormalization() | |
| #->ifNull() | |
| #->then(static fn (mixed $v): int => 5) | |
| #->end() |
7c1b5ab to
56e02f6
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR addresses issue #832 by updating the configuration for "page_limit" so that it accepts null values. The changes include switching from an integer node to a scalar node, adding validation for integer or null values, and introducing a normalization step for null values.
| ->end() | ||
| ->beforeNormalization() | ||
| ->ifNull() | ||
| ->then(static fn (mixed $v): int => 5) |
There was a problem hiding this comment.
The normalization step converts an explicit null value to 5, which may override a user's intention to provide a null. Consider preserving null if the goal is to allow 'page_limit' to be explicitly set to null.
There was a problem hiding this comment.
Pull Request Overview
Fixes issue #832 by allowing the page_limit configuration to be explicitly set to null while still validating integer values.
- Changed
page_limitnode fromintegerNodetoscalarNodewithdefaultNulland custom validation. - Added a validation rule to ensure values are either
nullor an integer.
661cf16 to
ae78849
Compare
Fix #832