Skip to content

feat(core): add experimental Arktype support for schema validation#161

Merged
halvaradop merged 1 commit intomasterfrom
feat/add-experimental-arktype
May 6, 2026
Merged

feat(core): add experimental Arktype support for schema validation#161
halvaradop merged 1 commit intomasterfrom
feat/add-experimental-arktype

Conversation

@halvaradop
Copy link
Copy Markdown
Member

@halvaradop halvaradop commented May 6, 2026

Summary by CodeRabbit

  • New Features

    • Added ArkType as a supported schema validation library alongside Zod and Valibot.
    • Added OAuth redirect URI creation helper for improved authentication flow handling.
  • Improvements

    • Extended identity system to support ArkType for flexible schema validation.
    • Enhanced schema registry with ArkType support and unknown key policies (strip, passthrough, strict).
  • Tests

    • Expanded test coverage for ArkType integration with identity schemas and schema validation.

@halvaradop halvaradop added feature New functionality experimental labels May 6, 2026
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
auth Skipped Skipped May 6, 2026 4:26pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Caution

Review failed

Failed to post review comments

📝 Walkthrough

Walkthrough

This PR adds comprehensive ArkType schema support alongside existing Zod and Valibot integrations. Changes span from dependency addition through type system extensions, runtime schema handling, identity creation, and full test coverage for the new schema library pathway.

Changes

ArkType Schema Support Integration

Layer / File(s) Summary
Dependency & Type Foundation
packages/core/package.json, packages/core/src/@types/config.ts
Added arktype ^2.2.0 dependency. Extended IdentityConfig generic constraint to permit Type<any> alongside Zod and Valibot object schemas.
Type Utilities & Predicates
packages/core/src/@types/utility.ts, packages/core/src/shared/assert.ts
Introduced IsArkType, IsZod, IsValibot type predicates and new type mappings (ArktypeShapeToObject, EditableShapeArkType). Reworked ConfigSchema and FromShapeToObject with multi-branch conditionals routing to appropriate schema handler. Added isArkType() runtime type guard.
Identity & Shape Ecosystem
packages/core/src/shared/identity.ts
Added UserIdentityArkType with ArkType-native field definitions. Introduced Identities union including ArkType variant. Extended createIdentity to recognize and handle ArkType via isArkType check. Updated UserIdentity.email to use zod/v4 API (z.email()).
Schema Registry & Validation
packages/core/src/schema-registry.ts
Extended stripUnknownKeys to handle ArkType with strip/passthrough/strict modes. Broadened createSchemaRegistry to accept Type and route to ArkType partial() and validation via allows(). Updated parse and parseAsPartial with ArkType-specific invocation and error handling.
Auth Integration
packages/core/src/createAuth.ts, packages/core/src/actions/signIn/authorization.ts
Refactored type imports to source Identities and FromShapeToObject from new locations. Added createRedirectURI() helper for OAuth callback URI computation.
Minor Formatting & Tests
packages/core/src/session/stateless.ts, packages/core/test/identity.test.ts, packages/core/test/types.test-d.ts
Inlined conditional expressions in session refresh logic. Expanded identity tests to cover stripUnknownKeys and createSchemaRegistry across Zod, Valibot, and ArkType schemas with different unknownKeys strategies. Added ArkType identity test in types.test-d.ts.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

  • aura-stack-ts/auth#160: Parallel schema library integration pattern adding Valibot support using the same type-utility, identity, and schema-registry codepaths.
  • aura-stack-ts/auth#130: Foundation work on identity and schema validation infrastructure that this PR extends with ArkType pathways.
  • aura-stack-ts/auth#150: Related refactoring of type inference utilities (FromShapeToObject and ConfigSchema logic) that this PR enhances with ArkType branches.

Poem

🐰 ✨ A rabbit hops through three schema lands,
Zod and Valibot joined by ArkType's hands.
Type guards twitch their whiskers with pride,
As identities dance in a unified stride.
Now validation knows every path it roams! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding experimental Arktype support for schema validation, which is the core focus across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-experimental-arktype

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@halvaradop halvaradop merged commit a32ca7d into master May 6, 2026
7 checks passed
@halvaradop halvaradop deleted the feat/add-experimental-arktype branch May 6, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

experimental feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant