fix: standard schema validation works with arktype (#5110)#5144
fix: standard schema validation works with arktype (#5110)#5144
Conversation
Arktype schemas are callable (typeof === 'function'), so isStandardSchema() was rejecting them because isObject() only accepts typeof === 'object'. Updated the check to accept both objects and functions with the ~standard property, matching the standard schema spec. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Deploy Preview for vee-validate-v5 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: 3e2b58c The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for vee-validate-docs canceled.
|
There was a problem hiding this comment.
Pull request overview
Fixes vee-validate’s standard schema detection to support callable schemas (e.g., arktype), aligning isStandardSchema() with the standard schema spec so schema-based validation routing works correctly.
Changes:
- Updated
isStandardSchema()to accept both objects and functions that expose the~standardproperty. - Added focused unit tests covering callable schemas, plain object schemas, and non-schema inputs.
- Added a changeset for a patch release of
vee-validate.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/vee-validate/src/utils/assertions.ts | Expands isStandardSchema type guard to include callable schemas with ~standard. |
| packages/vee-validate/tests/utils/assertions.spec.ts | Adds test coverage for isStandardSchema across expected/edge input shapes. |
| .changeset/fix-5110-arktype-compat.md | Declares a patch release note for the arktype/standard schema compatibility fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
typeof === 'function'), soisStandardSchema()was rejecting them becauseisObject()only acceptstypeof === 'object'isStandardSchemato accept both objects and functions with the~standardproperty, matching the standard schema specisStandardSchemacovering callable schemas, primitives, arrays, and plain objectsDetails
The root cause was in
packages/vee-validate/src/utils/assertions.ts:Arktype schemas are both functions and standard schemas — they are callable but also have the
~standardproperty. TheisObject()utility usestypeof obj === 'object'which returnsfalsefor functions, causingisStandardSchema()to returnfalsefor arktype schemas. This made vee-validate fall through to theisCallable(rules)branch, which tried to call the arktype schema as a plain validation function, leading toTypeError: rule is not a function.Test plan
isStandardSchemainassertions.spec.ts~standard🤖 Generated with Claude Code