Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions apps/content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@
"@orpc/vue-colada": "workspace:*",
"@orpc/vue-query": "workspace:*",
"@orpc/zod": "workspace:*",
"@pinia/colada": "^0.15.0",
"@pinia/colada": "^0.15.3",
"@shikijs/vitepress-twoslash": "^3.0.0",
"@tanstack/react-query": "^5.72.3",
"@tanstack/react-query": "^5.75.7",
"@tanstack/solid-query": "^5.72.3",
"@tanstack/svelte-query": "^5.72.3",
"@tanstack/vue-query": "^5.72.3",
"@types/node": "^22.14.1",
"@types/node": "^22.15.17",
"openai": "^4.93.0",
"pinia": "^3.0.0",
"pinia": "^3.0.2",
"superjson": "^2.2.2",
"svelte": "^5.26.2",
"vitepress": "1.6.3",
"vitepress-plugin-group-icons": "^1.4.1",
"vitepress-plugin-llms": "^1.1.0",
"vitepress-plugin-shiki-twoslash": "^0.0.6",
"vue": "3.5.13"
"vue": "^3.5.14"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@testing-library/react": "^16.0.1",
"@testing-library/svelte": "^5.2.7",
"@testing-library/user-event": "^14.6.1",
"@types/node": "^22.14.1",
"@types/node": "^22.15.17",
"@vitest/coverage-v8": "^3.0.4",
"@vitest/ui": "^3.0.9",
"@vue/test-utils": "^2.4.6",
Expand All @@ -43,7 +43,7 @@
"jsdom": "^26.0.0",
"lint-staged": "^15.2.10",
"simple-git-hooks": "^2.11.1",
"typescript": "5.8.3",
"typescript": "^5.8.3",
"unbuild": "^3.5.0",
"vite-plugin-solid": "^2.11.6",
"vitest": "^3.0.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@
"@orpc/standard-server-peer": "workspace:*"
},
"devDependencies": {
"zod": "^3.24.2"
"zod": "3.25.0-beta.20250516T005923"
}
}
2 changes: 1 addition & 1 deletion packages/contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@
"devDependencies": {
"arktype": "2.1.20",
"valibot": "1.0.0",
"zod": "^3.24.2"
"zod": "3.25.0-beta.20250516T005923"
}
}
6 changes: 3 additions & 3 deletions packages/nest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@
},
"devDependencies": {
"@nestjs/common": "^11.1.0",
"@nestjs/core": "^11.0.0",
"@nestjs/core": "^11.0.1",
"@nestjs/platform-express": "^11.1.0",
"@nestjs/platform-fastify": "^11.1.0",
"@nestjs/testing": "^11.1.0",
"@ts-rest/core": "^3.52.1",
"@types/express": "^5.0.1",
"express": "^5.0.0",
"fastify": "^5.0.0",
"rxjs": "^7.0.0",
"rxjs": "^7.8.1",
"supertest": "^7.1.0",
"zod": "^3.24.4"
"zod": "3.25.0-beta.20250516T005923"
}
}
2 changes: 1 addition & 1 deletion packages/openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@
"rou3": "^0.6.0"
},
"devDependencies": {
"zod": "^3.24.2"
"zod": "3.25.0-beta.20250516T005923"
}
}
2 changes: 1 addition & 1 deletion packages/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
"devDependencies": {
"@tanstack/vue-query": "^5.72.3",
"react": "^19.1.0",
"zod": "^3.24.2"
"zod": "3.25.0-beta.20250516T005923"
}
}
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
},
"devDependencies": {
"react": "^19.1.0",
"zod": "^3.24.2"
"zod": "3.25.0-beta.20250516T005923"
}
}
2 changes: 1 addition & 1 deletion packages/solid-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
},
"devDependencies": {
"@tanstack/vue-query": "^5.72.3",
"zod": "^3.24.2"
"zod": "3.25.0-beta.20250516T005923"
}
}
2 changes: 1 addition & 1 deletion packages/standard-server-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@orpc/standard-server": "workspace:*"
},
"devDependencies": {
"@types/node": "^22.14.1",
"@types/node": "^22.15.17",
"@types/supertest": "^6.0.3",
"supertest": "^7.1.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
},
"devDependencies": {
"@tanstack/vue-query": "^5.72.3",
"zod": "^3.24.2"
"zod": "3.25.0-beta.20250516T005923"
}
}
4 changes: 3 additions & 1 deletion packages/vue-colada/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
"@orpc/shared": "workspace:*"
},
"devDependencies": {
"pinia": "^3.0.0"
"@pinia/colada": "^0.15.3",
"pinia": "^3.0.2",
"vue": "^3.5.14"
}
}
2 changes: 1 addition & 1 deletion packages/vue-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
},
"dependencies": {
"@orpc/shared": "workspace:*",
"@tanstack/vue-query": "^5.72.2"
"@tanstack/vue-query": "^5.72.3"
}
}
16 changes: 2 additions & 14 deletions packages/zod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,16 @@
"peerDependencies": {
"@orpc/contract": "workspace:*",
"@orpc/server": "workspace:*",
"@zod/core": ">=0.11.4",
"zod": ">=3.24.2"
},
"peerDependenciesMeta": {
"@zod/core": {
"optional": true
},
"zod": {
"optional": true
}
},
"dependencies": {
"@orpc/openapi": "workspace:*",
"@orpc/shared": "workspace:*",
"escape-string-regexp": "^5.0.0",
"wildcard-match": "^5.1.3"
},
"devDependencies": {
"@zod/core": "^0.11.4",
"@zod/mini": "^4.0.0-beta.20250505T012514",
"zod": "^3.24.2",
"zod-to-json-schema": "^3.24.5",
"zod4": "npm:zod@^4.0.0-beta.20250505T012514"
"zod": "3.25.0-beta.20250516T005923",
"zod-to-json-schema": "^3.24.5"
}
}
18 changes: 17 additions & 1 deletion packages/zod/src/zod4/coercer.combination.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import z from 'zod4'
import z from 'zod/v4'
import { testSchemaSmartCoercion } from '../../tests/shared'

const InfiniteLazySchema = z.lazy(() => z.object({ boolean: z.boolean(), value: z.lazy(() => InfiniteLazySchema) })) as any
Expand Down Expand Up @@ -95,6 +95,22 @@ testSchemaSmartCoercion([
input: 'true',
expected: true,
},
{
name: 'default - undefined',
schema: z.boolean().default(false),
input: undefined,
},
{
name: 'prefault - boolean',
schema: z.boolean().prefault(false),
input: 'true',
expected: true,
},
{
name: 'prefault - undefined',
schema: z.boolean().prefault(false),
input: undefined,
},
{
name: 'nullable - boolean',
schema: z.boolean().nullable(),
Expand Down
2 changes: 1 addition & 1 deletion packages/zod/src/zod4/coercer.native.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import z from 'zod4'
import z from 'zod/v4'
import { testSchemaSmartCoercion } from '../../tests/shared'

enum TestEnum {
Expand Down
2 changes: 1 addition & 1 deletion packages/zod/src/zod4/coercer.rest.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import z from 'zod4'
import z from 'zod/v4'
import { testSchemaSmartCoercion } from '../../tests/shared'

testSchemaSmartCoercion([
Expand Down
2 changes: 1 addition & 1 deletion packages/zod/src/zod4/coercer.structure.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import z from 'zod4'
import z from 'zod/v4'
import { testSchemaSmartCoercion } from '../../tests/shared'

testSchemaSmartCoercion([
Expand Down
2 changes: 1 addition & 1 deletion packages/zod/src/zod4/coercer.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as z from 'zod4'
import * as z from 'zod/v4'
import {
experimental_ZodSmartCoercionPlugin as ZodSmartCoercionPlugin,
} from './coercer'
Expand Down
38 changes: 35 additions & 3 deletions packages/zod/src/zod4/coercer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
import type { Context } from '@orpc/server'
import type { StandardHandlerOptions, StandardHandlerPlugin } from '@orpc/server/standard'
import type { $ZodArray, $ZodCatch, $ZodDefault, $ZodEnum, $ZodIntersection, $ZodLazy, $ZodLiteral, $ZodMap, $ZodNonOptional, $ZodNullable, $ZodObject, $ZodOptional, $ZodPipe, $ZodReadonly, $ZodRecord, $ZodSet, $ZodTuple, $ZodType, $ZodUnion, util } from '@zod/core'
import type {
$ZodArray,
$ZodCatch,
$ZodDefault,
$ZodEnum,
$ZodIntersection,
$ZodLazy,
$ZodLiteral,
$ZodMap,
$ZodNonOptional,
$ZodNullable,
$ZodObject,
$ZodOptional,
$ZodPipe,
$ZodPrefault,
$ZodReadonly,
$ZodRecord,
$ZodSet,
$ZodTuple,
$ZodType,
$ZodUnion,
util,
} from 'zod/v4/core'
import { guard, isObject } from '@orpc/shared'

export class experimental_ZodSmartCoercionPlugin<TContext extends Context> implements StandardHandlerPlugin<TContext> {
Expand Down Expand Up @@ -273,11 +295,21 @@ export class experimental_ZodSmartCoercionPlugin<TContext extends Context> imple
}

case 'default':
case 'catch': {
const default_ = schema as $ZodDefault | $ZodCatch
case 'prefault': {
const default_ = schema as $ZodDefault | $ZodPrefault

if (value === undefined) {
return value
}

return this.#coerce(default_._zod.def.innerType, value)
}

case 'catch': {
const catch_ = schema as $ZodCatch
return this.#coerce(catch_._zod.def.innerType, value)
}

case 'lazy': {
const lazy = schema as $ZodLazy

Expand Down
2 changes: 1 addition & 1 deletion packages/zod/src/zod4/converter.combination.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import z from 'zod4'
import z from 'zod/v4'
import { testSchemaConverter } from '../../tests/shared'

testSchemaConverter([
Expand Down
9 changes: 7 additions & 2 deletions packages/zod/src/zod4/converter.meta.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as z from 'zod4'
import * as z from 'zod/v4'
import { testSchemaConverter } from '../../tests/shared'
import {
experimental_JSON_SCHEMA_INPUT_REGISTRY as JSON_SCHEMA_INPUT_REGISTRY,
Expand Down Expand Up @@ -64,10 +64,15 @@ testSchemaConverter([
schema: z.string().default('a'),
input: [false, { default: 'a', type: 'string' }],
},
{
name: 'string.prefault("a")',
schema: z.string().prefault('a'),
input: [false, { default: 'a', type: 'string' }],
},
{
name: 'string.catch("a")',
schema: z.string().catch('a'),
input: [false, { type: 'string' }],
input: [true, { type: 'string' }],
},
{
name: 'string.readonly()',
Expand Down
2 changes: 1 addition & 1 deletion packages/zod/src/zod4/converter.native.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as z from 'zod4'
import * as z from 'zod/v4'
import { testSchemaConverter } from '../../tests/shared'

enum ExampleEnum {
Expand Down
2 changes: 1 addition & 1 deletion packages/zod/src/zod4/converter.number.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import z from 'zod4'
import z from 'zod/v4'
import { testSchemaConverter } from '../../tests/shared'

testSchemaConverter([
Expand Down
2 changes: 1 addition & 1 deletion packages/zod/src/zod4/converter.processed.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import z from 'zod4'
import z from 'zod/v4'
import { testSchemaConverter } from '../../tests/shared'

testSchemaConverter([
Expand Down
2 changes: 1 addition & 1 deletion packages/zod/src/zod4/converter.rest.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import z from 'zod4'
import z from 'zod/v4'
import { testSchemaConverter } from '../../tests/shared'

testSchemaConverter([
Expand Down
2 changes: 1 addition & 1 deletion packages/zod/src/zod4/converter.string.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import z from 'zod4'
import z from 'zod/v4'
import { testSchemaConverter } from '../../tests/shared'

testSchemaConverter([
Expand Down
9 changes: 7 additions & 2 deletions packages/zod/src/zod4/converter.structure.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as zm from '@zod/mini'
import z from 'zod4'
import z from 'zod/v4'
import * as zm from 'zod/v4-mini'
import { testSchemaConverter } from '../../tests/shared'

testSchemaConverter([
Expand Down Expand Up @@ -29,6 +29,11 @@ testSchemaConverter([
input: [true, { type: 'array', items: { type: 'string' } }],
output: [true, { type: 'array', items: { anyOf: [{ type: 'string' }, { type: 'null' }] } }],
},
{
name: 'array(z.string().optional())',
schema: z.array(z.string().optional().default('a')),
input: [true, { type: 'array', items: { type: 'string', default: 'a' } }],
},
{
name: 'array(z.undefined())',
schema: z.array(z.undefined()),
Expand Down
6 changes: 3 additions & 3 deletions packages/zod/src/zod4/converter.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as zm from '@zod/mini'
import * as z from 'zod4'
import * as z from 'zod/v4'
import * as zm from 'zod/v4-mini'
import {
experimental_ZodToJsonSchemaConverter as ZodToJsonSchemaConverter,
} from './converter'
Expand All @@ -16,7 +16,7 @@ describe('zodToJsonSchemaConverter', () => {
expect(converter.condition(v.string())).toBe(false)
})

it('@zod/mini', async () => {
it('zod mini', async () => {
const schema = zm.object({
value: zm.string().check(zm.minLength(5), zm.maxLength(10), zm.regex(/^[a-z\\]+$/)),
})
Expand Down
Loading