Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
openai-zod-to-json-schema
Advanced tools
Convert Zod schemas to JSON schemas which are optionally compatible with OpenAI's structured outputs.
Convert Zod schemas to JSON schemas which are optionally compatible with OpenAI's structured outputs.
This package exports OpenAI's vendored version of zod-to-json-schema as a standalone module (the source code is copied directly to guarantee a 1:1 match).
It re-adds all of the unit tests from the original zod-to-json-schema by Stefan Terdell.
It also adds some additional unit tests for OpenAI's strict
mode. See OpenAI's docs on structured outputs for more details on the subset of JSON Schemas that are supported by OpenAI's structured outputs.
This package will be kept in sync with any changes to OpenAI's vendored version.
[!NOTE] This package requires
Node.js >= 18
or an equivalent environment (Bun, Deno, CF workers, etc).
npm install openai-zod-to-json-schema zod
All usage is the same as the original zod-to-json-schema, with the addition of a single optional boolean option: openaiStrictMode
.
import { zodToJsonSchema } from 'openai-zod-to-json-schema'
import { z } from 'zod'
const schema = zodToJsonSchema(z.any(), { openaiStrictMode: true })
zod-to-json-schema
without depending on the entire openai
package.zod-to-json-schema
removed all unit tests for some reason, which could cause undesired regressions.zod-to-json-schema
for openai-fetch, dexter, and agentic.MIT © Travis Fischer
Also see the original zod-to-json-schema license.
FAQs
Convert Zod schemas to JSON schemas which are optionally compatible with OpenAI's structured outputs.
We found that openai-zod-to-json-schema demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.