fix: improve json-schema test robustness

pull/715/head
Travis Fischer 2025-06-24 23:00:49 -05:00
rodzic e7d820fa39
commit 2f18f53b4b
4 zmienionych plików z 80 dodań i 63 usunięć

Wyświetl plik

@ -30,7 +30,9 @@
"test:unit": "vitest run" "test:unit": "vitest run"
}, },
"devDependencies": { "devDependencies": {
"json-schema-test-suite": "github:json-schema-org/JSON-Schema-Test-Suite#76b529f" "json-schema-test-suite": "github:json-schema-org/JSON-Schema-Test-Suite#76b529f",
"ky": "catalog:",
"p-map": "catalog:"
}, },
"publishConfig": { "publishConfig": {
"access": "public", "access": "public",

Wyświetl plik

@ -1,3 +1,6 @@
import ky from 'ky'
import pMap from 'p-map'
import { dereference, type Schema } from '../src/index' import { dereference, type Schema } from '../src/index'
let lookup: Record<string, Schema> | undefined let lookup: Record<string, Schema> | undefined
@ -6,6 +9,7 @@ export async function loadMeta() {
if (lookup) { if (lookup) {
return lookup return lookup
} }
lookup = Object.create({}) lookup = Object.create({})
const ids = [ const ids = [
'http://json-schema.org/draft-04/schema', 'http://json-schema.org/draft-04/schema',
@ -27,15 +31,17 @@ export async function loadMeta() {
'https://json-schema.org/draft/2020-12/meta/unevaluated' 'https://json-schema.org/draft/2020-12/meta/unevaluated'
] ]
await Promise.all( await pMap(
ids.map(async (id) => { ids,
const response = await fetch(id) async (id) => {
const schema: any = await response.json() const schema = await ky.get(id).json<Schema>()
dereference(schema, lookup) dereference(schema, lookup)
}) },
{
concurrency: 4
}
) )
Object.freeze(lookup) Object.freeze(lookup)
return lookup return lookup
} }

Wyświetl plik

@ -289,7 +289,7 @@ catalogs:
specifier: ^5.0.0 specifier: ^5.0.0
version: 5.0.0 version: 5.0.0
p-map: p-map:
specifier: ^7.0.3 specifier: 7.0.3
version: 7.0.3 version: 7.0.3
p-times: p-times:
specifier: ^4.0.0 specifier: ^4.0.0
@ -1073,6 +1073,12 @@ importers:
json-schema-test-suite: json-schema-test-suite:
specifier: github:json-schema-org/JSON-Schema-Test-Suite#76b529f specifier: github:json-schema-org/JSON-Schema-Test-Suite#76b529f
version: https://codeload.github.com/json-schema-org/JSON-Schema-Test-Suite/tar.gz/76b529f version: https://codeload.github.com/json-schema-org/JSON-Schema-Test-Suite/tar.gz/76b529f
ky:
specifier: 'catalog:'
version: 1.8.1
p-map:
specifier: 'catalog:'
version: 7.0.3
packages/openapi-utils: packages/openapi-utils:
dependencies: dependencies:

Wyświetl plik

@ -3,61 +3,58 @@ packages:
- apps/* - apps/*
- examples/* - examples/*
- packages/fixtures/valid/* - packages/fixtures/valid/*
onlyBuiltDependencies:
- "@sentry/cli"
ignoredBuiltDependencies:
- "@fisch0920/config"
catalog: catalog:
"@agentic/core": ^7.6.7 '@agentic/core': ^7.6.7
"@agentic/serper": ^7.6.7 '@agentic/serper': ^7.6.7
"@ai-sdk/openai": ^1.3.22 '@ai-sdk/openai': ^1.3.22
"@apideck/better-ajv-errors": ^0.3.6 '@apideck/better-ajv-errors': ^0.3.6
"@clack/prompts": ^0.11.0 '@clack/prompts': ^0.11.0
"@cloudflare/workers-types": ^4.20250620.0 '@cloudflare/workers-types': ^4.20250620.0
"@commander-js/extra-typings": ^14.0.0 '@commander-js/extra-typings': ^14.0.0
"@dotenvx/dotenvx": ^1.45.1 '@dotenvx/dotenvx': ^1.45.1
"@edge-runtime/vm": ^5.0.0 '@edge-runtime/vm': ^5.0.0
"@fisch0920/config": ^1.1.3 '@fisch0920/config': ^1.1.3
"@fisch0920/drizzle-orm": ^0.43.7 '@fisch0920/drizzle-orm': ^0.43.7
"@fisch0920/drizzle-zod": ^0.7.9 '@fisch0920/drizzle-zod': ^0.7.9
"@hono/mcp": ^0.1.0 '@hono/mcp': ^0.1.0
"@hono/node-server": 1.14.4 '@hono/node-server': 1.14.4
"@hono/sentry": ^1.2.2 '@hono/sentry': ^1.2.2
"@hono/zod-openapi": ^0.19.8 '@hono/zod-openapi': ^0.19.8
"@hono/zod-validator": ^0.7.0 '@hono/zod-validator': ^0.7.0
"@modelcontextprotocol/sdk": ^1.13.0 '@modelcontextprotocol/sdk': ^1.13.0
"@number-flow/react": ^0.5.10 '@number-flow/react': ^0.5.10
"@paralleldrive/cuid2": ^2.2.2 '@paralleldrive/cuid2': ^2.2.2
"@pmndrs/assets": ^1.7.0 '@pmndrs/assets': ^1.7.0
"@radix-ui/react-dropdown-menu": ^2.1.15 '@radix-ui/react-dropdown-menu': ^2.1.15
"@radix-ui/react-label": ^2.1.7 '@radix-ui/react-label': ^2.1.7
"@radix-ui/react-slot": ^1.2.3 '@radix-ui/react-slot': ^1.2.3
"@radix-ui/react-tabs": ^1.1.12 '@radix-ui/react-tabs': ^1.1.12
"@radix-ui/react-tooltip": ^1.2.7 '@radix-ui/react-tooltip': ^1.2.7
"@react-email/components": ^0.1.0 '@react-email/components': ^0.1.0
"@react-three/cannon": ^6.6.0 '@react-three/cannon': ^6.6.0
"@react-three/drei": ^10.2.0 '@react-three/drei': ^10.2.0
"@react-three/fiber": ^9.1.2 '@react-three/fiber': ^9.1.2
"@react-three/postprocessing": ^3.0.4 '@react-three/postprocessing': ^3.0.4
"@react-three/rapier": ^2.1.0 '@react-three/rapier': ^2.1.0
"@redocly/openapi-core": ^1.34.3 '@redocly/openapi-core': ^1.34.3
"@sentry/cli": ^2.46.0 '@sentry/cli': ^2.46.0
"@sentry/cloudflare": ^9.30.0 '@sentry/cloudflare': ^9.30.0
"@sentry/core": ^9.30.0 '@sentry/core': ^9.30.0
"@sentry/node": ^9.30.0 '@sentry/node': ^9.30.0
"@standard-schema/spec": ^1.0.0 '@standard-schema/spec': ^1.0.0
"@tailwindcss/postcss": ^4.1.10 '@tailwindcss/postcss': ^4.1.10
"@tailwindcss/typography": ^0.5.16 '@tailwindcss/typography': ^0.5.16
"@tanstack/react-form": ^1.12.3 '@tanstack/react-form': ^1.12.3
"@tanstack/react-query": ^5.80.10 '@tanstack/react-query': ^5.80.10
"@tanstack/react-query-devtools": ^5.80.10 '@tanstack/react-query-devtools': ^5.80.10
"@types/canvas-confetti": ^1.9.0 '@types/canvas-confetti': ^1.9.0
"@types/ms": ^2.1.0 '@types/ms': ^2.1.0
"@types/node": ^24.0.4 '@types/node': ^24.0.4
"@types/react": ^19.1.8 '@types/react': ^19.1.8
"@types/react-dom": ^19.1.6 '@types/react-dom': ^19.1.6
"@types/semver": ^7.7.0 '@types/semver': ^7.7.0
"@types/three": ^0.177.0 '@types/three': ^0.177.0
agents: ^0.0.95 agents: ^0.0.95
ai: ^4.3.15 ai: ^4.3.15
ajv: ^8.17.1 ajv: ^8.17.1
@ -107,7 +104,7 @@ catalog:
openapi-typescript: ^7.8.0 openapi-typescript: ^7.8.0
ora: ^8.2.0 ora: ^8.2.0
p-all: ^5.0.0 p-all: ^5.0.0
p-map: ^7.0.3 p-map: 7.0.3
p-throttle: 7.0.0 p-throttle: 7.0.0
p-times: ^4.0.0 p-times: ^4.0.0
parse-json: ^8.3.0 parse-json: ^8.3.0
@ -147,3 +144,9 @@ catalog:
zod: ^3.25.67 zod: ^3.25.67
zod-to-json-schema: ^3.24.5 zod-to-json-schema: ^3.24.5
zod-validation-error: ^3.5.2 zod-validation-error: ^3.5.2
ignoredBuiltDependencies:
- '@fisch0920/config'
onlyBuiltDependencies:
- '@sentry/cli'