json-schema-typed provides comprehensive TypeScript definitions for JSON Schema, including inline documentation, to facilitate type-safe schema declaration. It currently supports JSON Schema Draft 07, Draft 2019-09, and Draft 2020-12, with the main export defaulting to Draft 2020-12. The library is purely for defining schemas and does not include validation functionality; users must integrate a separate validation library. Version 8.x is the current stable release, which transitioned to a pure ESM package and introduced several breaking changes. Release cadence follows semantic versioning, with major bumps for breaking changes like updating the default draft export.
npm install json-schema-typedVerified import paths — ran on the pinned version, not inferred.
Demonstrates defining a JSON Schema using `JSONSchema` type and `Format` enum, including a type-specific narrowed interface.
Migrate your project to use ES Modules (ESM) syntax (`import/export`). Ensure your `package.json` has `"type": "module"` or use `.mjs` file extensions for modules importing `json-schema-typed`.
Consult the package's README or documentation for the new export names. The provided export table details the updated naming conventions.
If you need to extend the interface directly, use `JSONSchema.Interface` which provides the previous interface definition.
Explicitly import the desired draft using subpaths, e.g., `import { type JSONSchema } from 'json-schema-typed/draft-07'`.Pair `json-schema-typed` with a separate JSON Schema validation library (e.g., `ajv`, `zod-to-json-schema`, etc.) to perform actual data validation.
Convert your consuming code to use ES module `import` syntax. Ensure your `package.json` includes `"type": "module"` or that your file has an `.mjs` extension.
Review the JSON Schema specification for the draft you are using (e.g., draft-2020-12, draft-07). Ensure the keyword is valid and applied correctly. Also, consider using the type-specific narrowed interfaces like `JSONSchema.String` if applicable, as they provide stricter typing for certain schema types.
For v8.0.0+, ensure you are using the correct, renamed exports (e.g., `JSONSchema` for the main type) and importing from the correct path. If you need Draft 07, import from `json-schema-typed/draft-07`.
No dependency data recorded yet.