@zudojs/validation 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,16 +34,10 @@ export function any(...validators) {
34
34
  return result;
35
35
  issues.push(...result.issues);
36
36
  }
37
- return failure(issues.length > 0
38
- ? issues
39
- : [
40
- {
41
- path: [],
42
- code: "no_validator_succeeded",
43
- message: "No validation rule accepted the value.",
44
- received: value,
45
- },
46
- ]);
37
+ // Never echo the rejected value: issues flow into a 400 response and
38
+ // into logs, so `received` would hand back the password or token that
39
+ // was just refused.
40
+ return failure(issues.length > 0 ? issues : [noValidatorSucceeded()]);
47
41
  };
48
42
  }
49
43
  /**
@@ -85,6 +85,13 @@ export function traverse(root, visitor, rootPath = "root") {
85
85
  deepest = depth;
86
86
  if (!isContainer(value))
87
87
  continue;
88
+ // A container occupies the level below the one it sits at, so an empty
89
+ // `{}` at depth d reaches d + 1 — the same level at which the depth
90
+ // guard below refuses to descend into it. Reporting only leaf depths
91
+ // made `getSerializationDepth({})` 0 while `assertDepthWithinLimit({},
92
+ // 0)` threw.
93
+ if (depth + 1 > deepest)
94
+ deepest = depth + 1;
88
95
  if (onPath.has(value)) {
89
96
  if (visitor.failOnCycle) {
90
97
  throw new TraversalLimitError("cycle", path, depth);
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@zudojs/validation",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Schema validation with Zod integration, constraints, parsers, composers, circular detection, and depth/size checks.",
5
5
  "license": "MIT",
6
+ "author": {
7
+ "name": "Oluwayemi Oyinlola",
8
+ "url": "https://github.com/oyinlola-tech"
9
+ },
6
10
  "type": "module",
7
11
  "main": "./dist/index.js",
8
12
  "module": "./dist/index.js",
@@ -22,7 +26,7 @@
22
26
  ],
23
27
  "dependencies": {
24
28
  "zod": "^4.4.3",
25
- "@zudojs/errors": "1.0.0"
29
+ "@zudojs/errors": "1.0.1"
26
30
  },
27
31
  "devDependencies": {
28
32
  "typescript": "7.0.2",