supermemory/packages/validation
abhay-codes07 a30cfaa4c3
fix(validation): reject non-positive page/limit in pagination query schemas
Both pagination query schemas validated only the upper bound, so
malformed pagination flowed straight through the API's source-of-truth
validation into the query layer instead of failing with a clean 400:

- ListMemoriesQuerySchema guards its string branch with /^\d+$/ (which
  still admits "0"), but the z.number() branch accepted any number:
  { page: -1, limit: -5 } and fractional values like 2.5 parsed
  successfully; only limit > 1100 was rejected
- DocumentsWithMemoriesQuerySchema (the input schema for
  POST /documents/documents) had bare z.number() for both page and
  limit with no bounds at all

Require page and limit to be positive integers in both schemas. The
1100 limit cap and all defaults are unchanged, and no new upper bound
is introduced for the documents schema since existing web flows
legitimately request large pages.

Covered with bun tests: defaults, numeric and numeric-string
acceptance, the 1100 cap, and rejection of zero/negative/fractional
values on both schemas.
2026-07-13 01:43:31 +05:30
..
api.test.ts fix(validation): reject non-positive page/limit in pagination query schemas 2026-07-13 01:43:31 +05:30
api.ts fix(validation): reject non-positive page/limit in pagination query schemas 2026-07-13 01:43:31 +05:30
package.json Enhanced Text Editor and format fixes with biome (#371) 2025-08-21 08:40:44 -07:00
schemas.ts PR: nova alpha release (#670) 2026-01-13 00:54:56 -08:00
tsconfig.json New Version of Supermemory Consumer App 2025-08-16 18:50:10 -07:00