Skip to content

Commit 4bdc59b

Browse files
committed
Improve schema-to-json peer deps and fix effect schema
1 parent 5371af6 commit 4bdc59b

File tree

4 files changed

+147
-279
lines changed

4 files changed

+147
-279
lines changed

packages/schema-to-json/package.json

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,34 +46,29 @@
4646
"@sodaru/yup-to-json-schema": "^2.0.1"
4747
},
4848
"devDependencies": {
49-
"@effect/schema": "^0.75.5",
5049
"arktype": "^2.0.0",
5150
"effect": "^3.11.11",
5251
"runtypes": "^6.7.0",
5352
"superstruct": "^2.0.2",
5453
"tshy": "^3.0.2",
5554
"@sinclair/typebox": "^0.34.3",
56-
"valibot": "^1.0.0-beta.8",
55+
"valibot": "^1.1.0",
5756
"vitest": "^2.1.8",
58-
"yup": "^1.6.1",
57+
"yup": "^1.7.0",
5958
"zod": "^3.24.1 || ^4.0.0",
6059
"rimraf": "6.0.1"
6160
},
6261
"peerDependencies": {
63-
"@effect/schema": "^0.75.5",
64-
"arktype": "^2.0.0",
65-
"effect": "^3.11.11",
66-
"runtypes": "^6.7.0",
67-
"superstruct": "^2.0.2",
68-
"@sinclair/typebox": "^0.34.3",
69-
"valibot": "^1.0.0-beta.8",
70-
"yup": "^1.6.1",
62+
"arktype": ">=2.0.0",
63+
"effect": ">=3.0.0",
64+
"runtypes": ">=5.0.0",
65+
"superstruct": ">=0.14.2",
66+
"@sinclair/typebox": ">=0.34.30",
67+
"valibot": ">=0.41.0",
68+
"yup": ">=1.0.0",
7169
"zod": "^3.24.1 || ^4.0.0"
7270
},
7371
"peerDependenciesMeta": {
74-
"@effect/schema": {
75-
"optional": true
76-
},
7772
"arktype": {
7873
"optional": true
7974
},

packages/schema-to-json/src/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,7 @@ export function schemaToJsonSchema(
142142
}
143143

144144
// Check if it's an Effect schema
145-
if (
146-
parser._tag === "Schema" ||
147-
parser._tag === "SchemaClass" ||
148-
typeof parser.ast === "function"
149-
) {
145+
if (typeof parser.ast === "object" && typeof parser.ast._tag === "string") {
150146
try {
151147
// @ts-ignore
152148
if (typeof globalThis.__effectJsonSchema !== "undefined") {

packages/schema-to-json/src/tests/index.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { describe, it, expect, beforeAll } from "vitest";
21
import { z } from "zod";
32
import * as y from "yup";
43
// @ts-ignore
54
import { type } from "arktype";
6-
import { Schema } from "@effect/schema";
5+
import { Schema } from "effect";
76
import { Type } from "@sinclair/typebox";
87
import {
98
schemaToJsonSchema,

0 commit comments

Comments
 (0)