Files
summercms/.planning/todos/pending/lagoon-validate-min-message.md
Jakub Zych f7dfe68707 docs(11.1-04): log lagoon gaps found while writing the Database pages
- lagoon.Validate reports numeric min failures with the max message
- the lagoon README callback example sorts after the after-commit flush,
  and the pivot Preload ordering claim does not hold
2026-09-30 22:59:30 +02:00

13 lines
1.1 KiB
Markdown

---
title: lagoon.Validate reports every numeric range failure with the max message
date: 2026-09-30
priority: medium
area: summercms.go lagoon
---
When a field has `integer` or `numeric` and a `min`, `max` or `between` rule, `lagoon.Validate` checks the range once and always answers a failure with the `max` message. With only `min:0` and a value of `-1`, the message is `The views may not be greater than .`: the wrong rule and an empty parameter. Laravel answers `The views must be at least 0.` for `min` and `The views must be between 0 and 10.` for a numeric `between`.
Found while writing `docs/database/casts-and-validation.md` (Phase 11.1 plan 04). The page does not show a `min` failure; its example uses `max:1000`, whose message is correct.
Suggested fix: in `modules/lagoon/validate.go`, pick the message by which bound failed (`min` below the lower bound, `max` above the upper, `between` when both bounds came from `between`), with a unit test per case. Check the PHP API responses first if a ported endpoint depends on the current text. The change is outside the docs phase boundary, so it is not made in Phase 11.1.