Skip to content

Make ArkType optional and support Standard Schema directly (core) #705

@yamcodes

Description

@yamcodes

ArkEnv currently relies on ArkType as a required dependency.
This issue tracks the work to make ArkType optional and allow ArkEnv to work with any Standard Schema–compatible validator (e.g. Zod, Valibot) without requiring ArkType to be installed.

Motivation

  • Reduce required dependencies and bundle size
  • Make ArkEnv truly validator-agnostic
  • Support teams that already use Zod or other validators
  • Enable gradual migration to ArkType instead of forcing it upfront
  • Align implementation with ArkEnv’s public positioning

Scope

  • ArkType becomes an optional peer dependency
  • ArkEnv supports Standard Schema validators directly
  • arkenv({ ... }) remains the primary entry point and supports:
    • ArkType schemas
    • Standard Schema validators
    • Mixing both (for migration use cases)
  • Coercion is ArkType-specific
    • Automatic coercion and DSL-based coercion are only enabled when ArkType is present
    • Standard Schema validators are responsible for their own coercion (e.g. z.coerce)
  • Error handling is normalized across validators

Non-goals

  • Implementing generic coercion for Standard Schema validators
  • Inferring or guessing coercion behavior from JSON Schema
  • Renaming the project
  • Splitting packages prematurely
  • Forcing identical behavior across all validators

Outcome

After this work:

  • Zod-only users can use ArkEnv without installing ArkType
  • Coercion behavior is explicit and predictable
  • ArkType remains the recommended validator for the best DX
  • ArkEnv becomes a stable, validator-agnostic foundation ahead of v1

Metadata

Metadata

Assignees

No one assigned

    Labels

    arkenvChanges to the `arkenv` npm package.enhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions