{"_id":"json-schema-typed@9.0.0","bugs":{"url":"https://github.com/RemyRylan/json-schema-typed/issues"},"dist":{"shasum":"007374a321081ede4417d7c5ab19795ce35a4524","tarball":"http://registry-npm.ywwl.com/json-schema-typed/download/json-schema-typed-9.0.0.tgz","fileCount":17,"integrity":"sha512-t+dkn3pLaz7ku3ELaBKBSQNjd0Sir5zR7Y4CpAR5a+UEH60NefBEAhAgJuWqDH5o4HDfH+EQjmXeQMLc+Xnbdg==","signatures":[{"sig":"MEYCIQCDKFK7gVtZ9jzPpsO219N/Q9T04fisKmi78kSmK1yxkwIhAM5bzbtzxikkgVSNmiV4n8Srrs5c+4iYq1+kNQskF2iu","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCkCNkB9KVFs1tpEWDF+nYm0j6s6/TbBgZc42nOYofBwQIgD83PIEdmu91s1YPymjufsWmUEgWxA93nVmpf4Lc1apU="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/json-schema-typed@9.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":300283,"size":57783,"noattachment":false,"key":"/json-schema-typed/-/json-schema-typed-9.0.0.tgz"},"main":"./2020_12.js","name":"json-schema-typed","type":"module","types":"./2020_12.d.ts","author":{"url":"https://github.com/RemyRylan","name":"Remy Rylan"},"exports":{".":{"types":"./2020_12.d.ts","default":"./2020_12.js"},"./v1":{"types":"./v1.d.ts","default":"./v1.js"},"./next":{"types":"./next.d.ts","default":"./next.js"},"./2019-09":{"types":"./2019_09.d.ts","default":"./2019_09.js"},"./2020-12":{"types":"./2020_12.d.ts","default":"./2020_12.js"},"./draft-07":{"types":"./draft_07.d.ts","default":"./draft_07.js"},"./draft-2019-09":{"types":"./draft_2019_09.d.ts","default":"./draft_2019_09.js"},"./draft-2020-12":{"types":"./draft_2020_12.d.ts","default":"./draft_2020_12.js"}},"gitHead":"326dcc1162b4a7a7db64762469b8c34bbc4c727d","license":"BSD-3-Clause","scripts":{"test":"npm run test:types && npm run test:runtime","build":"node --disable-warning=ExperimentalWarning src/build.ts","check":"tsc -p tsconfig.json --noUnusedLocals --noUnusedParameters --noImplicitReturns --noFallthroughCasesInSwitch && tsc -p tsconfig.check.json","test:types":"tsc -p tsconfig.json","test:runtime":"node --disable-warning=ExperimentalWarning --test \"test/*.test.ts\"","prepublishOnly":"npm run build && npm test","test:suite:generate":"node --disable-warning=ExperimentalWarning test/suite/generate.ts"},"version":"9.0.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"567eb45c-5169-441a-8d85-277d89eafdd2"}},"homepage":"https://github.com/RemyRylan/json-schema-typed","keywords":["jsonschema","typescript","types","definitions","json","schema"],"repository":{"url":"git+https://github.com/RemyRylan/json-schema-typed.git","type":"git"},"_npmVersion":"12.2.0","description":"JSON Schema TypeScript definitions with complete inline documentation.","directories":{},"maintainers":[{"name":"remyrylan","email":"remyrylan@outlook.com"}],"sideEffects":false,"_nodeVersion":"24.21.0","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"prettier":"^3.9.10","typescript":"^7.0.2","@types/node":"^26.6.5","typescript5":"npm:typescript@^5.9.3"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/json-schema-typed_9.0.0_1792090974548_0.8292853763562615"},"readme":"[![npm](https://img.shields.io/npm/v/json-schema-typed.svg?style=flat-square)](https://npmjs.org/package/json-schema-typed)\n[![downloads-per-month](https://img.shields.io/npm/dm/json-schema-typed.svg?style=flat-square&label=npm%20downloads)](https://npmjs.org/package/json-schema-typed)\n[![License](https://img.shields.io/badge/license-BSD--3--Clause-blue.svg?style=flat-square)][license]\n\n# JSON Schema Typed\n\nJSON Schema TypeScript definitions with complete inline documentation.\n\n**NOTE:** This library only supports defining schemas. You will need a separate\nlibrary for data validation.\n\nThere are 4 JSON Schema dialects included in this package:\n\n- `json-schema-typed/draft-07`\n- `json-schema-typed/2019-09` (also `json-schema-typed/draft-2019-09`)\n- `json-schema-typed/2020-12` (also `json-schema-typed/draft-2020-12`)\n- `json-schema-typed/v1` (also `json-schema-typed/next`)\n\n## Install\n\n```sh\nnpm install json-schema-typed\n```\n\n## Usage\n\n1. Choose which dialect you'd like to import.\n\n- The main package export points to the latest **released** specification,\n  currently `2020-12`. Future releases that point the main package export to a\n  new specification will always incur a bump to the major semantic version.\n\n  ```ts\n  import { type JSONSchema } from \"json-schema-typed\";\n  ```\n\n- Or you can specify the exact dialect you need.\n  ```ts\n  import { type JSONSchema } from \"json-schema-typed/2020-12\";\n  ```\n\n2. Define a schema\n\n   ```ts\n   import { Format, type JSONSchema } from \"json-schema-typed\";\n\n   const schema: JSONSchema = {\n     properties: {\n       email: {\n         format: Format.Email,\n         type: \"string\",\n       },\n     },\n     type: \"object\",\n   };\n\n   // The JSONSchema namespace also provides type-specific narrowed interfaces\n   const stringSchema: JSONSchema.String = {\n     // Only { type: \"string\" } and common keywords are allowed\n     maxLength: 100,\n     type: \"string\",\n   };\n   ```\n\n## Specification versions\n\nJSON Schema changed how it is versioned after 2020-12. The IETF-style drafts\n(`draft-07`, `2019-09`, `2020-12`) were each incompatible with one another, so\nthis package exposes one module per draft and you pin the one you write against.\n\nThe next specification is **JSON Schema v1**. It is versioned by a major version\nnumber plus a release year (`v1/2026`, `v1/2027`, ...). Releases within a\nversion are additive and backwards compatible, so a schema written for `v1/2026`\nstays valid for every later `v1` release. The `$schema` value\n`https://json-schema.org/v1` always means \"latest v1\". This package mirrors\nthat: there is one `v1` module, updated additively as yearly releases land (a\nminor version bump here). A new module would only appear for a breaking `v2`.\n\n```ts\nimport { type JSONSchema } from \"json-schema-typed/v1\";\n```\n\n> **v1 is unreleased.** The `v1` module is generated from the current `main`\n> branch of the specification repository and tracks it ahead of the first\n> official release (`v1/2026`). Keywords may still change until then. The main\n> package export stays on `2020-12` until v1 is published.\n\n### `json-schema-typed/next`\n\n`next` always points at the newest in-progress specification, whatever it is\ncalled — today that is `v1`. Import it if you want to follow the spec's working\ncopy; import `v1` if you want to stay on v1 even after a v2 appears.\n\n```ts\nimport { type JSONSchema } from \"json-schema-typed/next\";\n```\n\n### Legacy import paths\n\n`json-schema-typed/draft-2019-09` and `json-schema-typed/draft-2020-12` still\nwork and are the same modules as `json-schema-typed/2019-09` and\n`json-schema-typed/2020-12` (re-exports, not copies, so the types and enums are\nidentical whichever path you use). New code should use the shorter names.\n\n## Type checking\n\n`JSONSchema` describes any schema. Every keyword is optional and documented\ninline, so hovering a keyword in your editor shows the specification text.\n\n```ts\nconst schema: JSONSchema = {\n  type: \"object\",\n  properties: { count: { type: \"number\", minimum: 0 } },\n};\n```\n\n- `JSONSchema<Value>` constrains `type` to the kind of value described:\n  `JSONSchema<string>` has `type?: \"string\"`, and `JSONSchema<string | null>`\n  accepts `\"string\"`, `\"null\"`, or `[\"string\", \"null\"]`.\n- `JSONSchema.String`, `JSONSchema.Object`, `JSONSchema.Array`, ... declare only\n  the keywords that apply to that type.\n- `JSONSchema.Interface` is the object half of `JSONSchema`; extend it to add\n  custom keywords.\n- A schema whose literal types have been widened — imported from a `.json` file,\n  or built in a variable without `as const` — is still a `JSONSchema`.\n\nEvery schema in the official\n[JSON-Schema-Test-Suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite)\nis checked against `JSONSchema` as part of the test suite, and hover\ndocumentation is tested against the TypeScript language service. The published\ndeclarations are tested with TypeScript 4.7 and newer.\n\n`JSONSchema` is deliberately one object type rather than a union discriminated\non `type`: TypeScript only shows a keyword's documentation on hover when the\ncontextual type is a single declaration, so a union would remove the inline\ndocumentation that this package exists to provide. Use `JSONSchema.String`,\n`JSONSchema.Object`, etc. when you want only a type's own keywords offered.\n\n## Changelog\n\nRelease notes, including breaking changes and upgrade guidance, are in the\n[CHANGELOG](https://github.com/RemyRylan/json-schema-typed/blob/main/CHANGELOG.md).\n\n## Exports supported in each module\n\n| Name              | Type                | Purpose                                                             |\n| ----------------- | ------------------- | ------------------------------------------------------------------- |\n| `$schema`         | `string`            | Meta-schema URL that can be used with the `$schema` keyword.        |\n| `ContentEncoding` | Enum object         | String content encoding strategies.                                 |\n| `draft`           | `string`            | Specification identifier (`\"7\"`, `\"2019-09\"`, `\"2020-12\"`, `\"v1\"`). |\n| `Format`          | Enum object         | String formats.                                                     |\n| `JSONSchema`      | TypeScript Type     | Used to define a JSON Schema.                                       |\n| `keywords`        | `readonly string[]` | All the keywords for the imported specification.                    |\n| `KeywordByType`   | TypeScript Type     | Keyword names grouped by the `type` they apply to.                  |\n| `TypeName`        | Enum object         | Simple type names for the `type` keyword.                           |\n\n## Versioning\n\nThis library follows [semantic versioning](https://semver.org).\n\n## Contributing\n\nThe draft modules at the package root are generated from the definitions in\n[`src/draft`](https://github.com/RemyRylan/json-schema-typed/tree/main/src/draft).\nSee\n[`src/README.md`](https://github.com/RemyRylan/json-schema-typed/blob/main/src/README.md)\nfor how to build and test.\n\n---\n\n## Maintainers\n\n- [Remy Rylan](https://github.com/RemyRylan)\n\n## License\n\n[BSD-3-Clause][license]\n\n[license]: https://github.com/RemyRylan/json-schema-typed/blob/main/LICENSE.md\n","publish_time":1792090974636,"_cnpm_publish_time":1792090974636,"dist-tags":{"latest":"9.0.0"}}