-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
arkenvChanges to the `arkenv` npm package.Changes to the `arkenv` npm package.enhancementNew feature or requestNew feature or requestrfcA proposal open for discussion, inviting feedback before writing code. May or may not land as-isA proposal open for discussion, inviting feedback before writing code. May or may not land as-is
Milestone
Description
ArkEnv currently supports automatic coercion only when using ArkType. At the same time, many schema libraries (Zod, Valibot, ArkType, others) implement the Standard JSON Schema specification, which preserves structural type information when converting schemas to JSON Schema.
ArkEnv already performs coercion by introspecting JSON Schema. This RFC proposes to formally support opt-in, best effort coercion for Standard Schema validators using Standard JSON Schema as part of ArkEnv v1.
Goals
- Include Standard JSON Schema–based coercion in ArkEnv v1
- Make this coercion explicit and opt-in
- Reuse existing JSON Schema–based coercion logic where possible
- Clearly differentiate this behavior from ArkType coercion
- Keep ArkEnv validator-agnostic and framework-agnostic
Non-goals
- Making Standard Schema coercion the default
- Achieving feature parity with ArkType coercion
- Inferring or guessing validator-specific transforms or refinements
- Applying coercion silently or partially
- Changing existing ArkType coercion behavior
Proposed behavior
- ArkType schemas:
- Automatic coercion enabled by default
- Standard Schema validators:
- No coercion by default
- Optional, best-effort coercion based on Standard JSON Schema input
- Coercion is structural only (e.g. primitives, arrays, JSON objects)
Open questions
- What coercion scope is acceptable for v1 (primitives only vs arrays/JSON)?
- How should this be exposed in the API (options vs helper)?
- How should failures or unsupported cases be surfaced to users?
- Should this be branded or named differently to avoid confusion with ArkType coercion?
Notes
This RFC intentionally scopes Standard Schema coercion as opt-in and best-effort. ArkType remains the recommended validator for the richest and most predictable coercion experience.
Reference
Metadata
Metadata
Assignees
Labels
arkenvChanges to the `arkenv` npm package.Changes to the `arkenv` npm package.enhancementNew feature or requestNew feature or requestrfcA proposal open for discussion, inviting feedback before writing code. May or may not land as-isA proposal open for discussion, inviting feedback before writing code. May or may not land as-is