moonming opened a new pull request, #3420:
URL: https://github.com/apache/apisix-dashboard/pull/3420

   ## What
   
   Fixes #3296.
   
   `zOneOf` used `xor(a, b)` as the *error* condition — but `xor` is `true` 
when exactly one operand is truthy, i.e. the **valid** state. The helper 
rejected exactly-one and accepted both-set/none-set: backwards on all four 
quadrants. The `as boolean` coercion also made a cleared form input (`''`) 
behave inconsistently.
   
   Note: `zOneOf` has **no call sites** on master today (the existing e2e 
`validation.zOneOf-single-field.spec.ts` exercises the form behavior, not this 
helper), so there is no user-facing behavior change — this defuses the trap 
before the next feature imports it.
   
   ## How
   
   - pass when exactly one key is filled; `undefined`/`null`/`''` count as not 
filled
   - one issue per key so both fields display the error (unchanged)
   - unit tests over all four quadrants + the empty-string case 
(`src/utils/zod.test.ts`)
   - wire `pnpm test` → `vitest run src`: the repo's only existing unit test 
(`src/types/schema/apisix/upstreams.test.ts`, guarding the #3376 discovery_args 
fix) had no runner script and never executed; now both files run in 400ms 
(scoped to `src` so vitest doesn't pick up the Playwright specs)
   
   ## Verification
   
   - `pnpm test`: 2 files, 9 tests pass (5 new)
   - `pnpm lint` clean, `tsc -b` clean
   
   Follow-up (tracked in #3417): add `pnpm test` to a CI workflow so schema 
unit tests gate PRs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to