Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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.
The npm package openai-zod-to-json-schema receives a total of 867 weekly downloads. As such, openai-zod-to-json-schema popularity was classified as not popular.
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.