{"name":"json-schema-typed","version":"8.0.2","keywords":["jsonschema","typescript","types","definitions","json","schema"],"author":{"url":"https://github.com/RemyRylan","name":"Remy Rylan"},"license":"BSD-2-Clause","_id":"json-schema-typed@8.0.2","maintainers":[{"name":"jrylan","email":"jeremyrylan@me.com"},{"name":"remyrylan","email":"remyrylan@outlook.com"}],"homepage":"https://github.com/RemyRylan/json-schema-typed/tree/main/dist/node","bugs":{"url":"https://github.com/RemyRylan/json-schema-typed/issues"},"dist":{"shasum":"e98ee7b1899ff4a184534d1f167c288c66bbeff4","tarball":"http://registry-npm.ywwl.com/json-schema-typed/download/json-schema-typed-8.0.2.tgz","fileCount":9,"integrity":"sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==","signatures":[{"sig":"MEQCIFo3yXEspmbPxqjrpTUR/niK0ZryS6g6bBGDYDCZTC8HAiB4lOihjPkybe99qO634bSyvmQ2qGFao2xuzqYGr7X7iQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":197188,"size":37491,"noattachment":false,"key":"/json-schema-typed/-/json-schema-typed-8.0.2.tgz"},"main":"./draft_2020_12.js","type":"module","types":"./draft_2020_12.d.ts","exports":{".":{"types":"./draft_2020_12.d.ts","default":"./draft_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":"613f3ab84c8e1b14de492534bfcb81d1499610a3","_npmUser":{"name":"remyrylan","email":"remyrylan@outlook.com"},"repository":{"url":"git+https://github.com/RemyRylan/json-schema-typed.git","type":"git"},"_npmVersion":"11.6.2","description":"JSON Schema TypeScript definitions with complete inline documentation.","directories":{},"_nodeVersion":"24.11.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/json-schema-typed_8.0.2_1763411424736_0.6438934808757768","host":"s3://npm-registry-packages-npm-production"},"readme":"[![npm](https://img.shields.io/npm/v/json-schema-typed.svg?style=flat-square)](https://npmjs.org/package/json-schema-typed)\r\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)\r\n[![License](https://img.shields.io/badge/license-BSD--2--Clause-blue.svg?style=flat-square)][license]\r\n\r\n# JSON Schema Typed\r\n\r\nJSON Schema TypeScript definitions with complete inline documentation.\r\n\r\n**NOTE:** This library only supports defining schemas. You will need a separate\r\nlibrary for data validation.\r\n\r\nThere are 3 JSON Schema drafts included in this package:\r\n\r\n- `draft-07`\r\n- `draft-2019-09`\r\n- `draft-2020-12`\r\n\r\n## Install\r\n\r\n```sh\r\nnpm install json-schema-typed\r\n```\r\n\r\n## Usage\r\n\r\n1. Chose which draft you'd like to import.\r\n\r\n- The main package export points to the latest supported stable draft, currently\r\n  `draft-2020-12`. Future releases that point the main package export to a new\r\n  draft will always incur a bump to the major semantic version.\r\n\r\n  ```ts\r\n  import { type JSONSchema } from \"json-schema-typed\";\r\n  ```\r\n\r\n- Or you can specify the exact draft you need.\r\n  ```ts\r\n  import { type JSONSchema } from \"json-schema-typed/draft-2020-12\";\r\n  ```\r\n\r\n2. Define a schema\r\n\r\n   ```ts\r\n   import { Format, type JSONSchema } from \"json-schema-typed\";\r\n\r\n   const schema: JSONSchema = {\r\n     properties: {\r\n       email: {\r\n         format: Format.Email,\r\n         type: \"string\",\r\n       },\r\n     },\r\n     type: \"object\",\r\n   };\r\n\r\n   // The JSONSchema namespace also provides type-specific narrowed interfaces\r\n   const stringSchema: JSONSchema.String = {\r\n     // Only { type: \"string\" } and common keywords are allowed\r\n     maxLength: 100,\r\n     type: \"string\",\r\n   };\r\n   ```\r\n\r\n## Upgrading\r\n\r\nVersion `8.0.0` has breaking changes from the previous release.\r\n\r\n- Now a\r\n  [pure ESM package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).\r\n- Many exports were renamed. The table below reflects the new export names.\r\n  These are considered final and unlikely to change in future releases.\r\n- The `JSONSchema` type was changed from an `interface` to a `type` which is a\r\n  mixed union that allows `boolean` values in order to properly align with the\r\n  JSON Schema spec. If you were previously extending the `JSONSchema` interface,\r\n  you can access the `interface` directly with `JSONSchema.Interface`.\r\n- The previous main package export pointed to Draft 7. Import it directly if you\r\n  need to continue using it:\r\n  ```ts\r\n  import { type JSONSchema } from \"json-schema-typed/draft-07\";\r\n  ```\r\n\r\n## Exports supported in each draft module\r\n\r\n| Name              | Type            | Purpose                                                            |\r\n| ----------------- | --------------- | ------------------------------------------------------------------ |\r\n| `$schema`         | `string`        | Draft meta schema URL that can be used with the `$schema` keyword. |\r\n| `ContentEncoding` | Enum object     | String content encoding strategies.                                |\r\n| `draft`           | `string`        | Draft version.                                                     |\r\n| `Format`          | Enum object     | String formats.                                                    |\r\n| `JSONSchema`      | TypeScript Type | Used to define a JSON Schema.                                      |\r\n| `keywords`        | `string[]`      | All the keywords for the imported draft.                           |\r\n| `TypeName`        | Enum object     | Simple type names for the `type` keyword.                          |\r\n\r\n## Versioning\r\n\r\nThis library follows [semantic versioning](https://semver.org).\r\n\r\n---\r\n\r\n## Maintainers\r\n\r\n- [Remy Rylan](https://github.com/RemyRylan)\r\n\r\n## License\r\n\r\n[BSD-2-Clause][license]\r\n\r\n[license]: https://github.com/RemyRylan/json-schema-typed/blob/main/dist/node/LICENSE.md\r\n","publish_time":1763411424942,"_cnpm_publish_time":1763411424942,"dist-tags":{"latest":"9.0.0"}}