{"_id":"@atek-cloud/json-schema-to-dts","_rev":"1-1dda36f1de0abc6c141fd8937f29424a","name":"@atek-cloud/json-schema-to-dts","dist-tags":{"latest":"1.5.0"},"versions":{"1.5.0":{"name":"@atek-cloud/json-schema-to-dts","version":"1.5.0","description":"Create TypeScript types from json-schema v7","main":"dist/index.js","types":"dist/index.d.ts","dependencies":{"ts-morph":"^8.1.1"},"devDependencies":{"@types/jest":"^26.0.14","@types/json-schema":"^7.0.6","@types/node":"^12.12.43","@types/prettier":"^2.0.1","@wessberg/rollup-plugin-ts":"^1.2.24","gh-release":"^5.0.0","jest":"^26.5.0","jest-junit":"^12.0.0","json-schema-test-suite":"github:json-schema-org/JSON-Schema-Test-Suite#0a0f0cd","kacl":"^1.1.1","prettier":"^2.1.2","rollup":"^2.11.2","ts-jest":"^26.0.0","ts-node":"^9.0.0","tslib":"^2.0.2","typescript":"^4.0.2"},"scripts":{"build":"rm -rf dist && rollup -c","generate":"ts-node ./scripts/generateTypes.ts","lint":"prettier --check src/**/*","test":"jest --verbose","posttest":"kacl lint","prepack":"npm run build","preversion":"kacl prerelease","version":"kacl release && git add CHANGELOG.md","postversion":"git push && gh-release"},"repository":{"type":"git","url":"git+https://github.com/ggoodman/json-schema-to-dts.git"},"keywords":[],"author":{"name":"Geoffrey Goodman"},"license":"MIT","bugs":{"url":"https://github.com/ggoodman/json-schema-to-dts/issues"},"homepage":"https://github.com/ggoodman/json-schema-to-dts#readme","engines":{"node":">=10.16.0"},"prettier":{"printWidth":100,"tabWidth":2,"singleQuote":true},"volta":{"node":"14.16.0","npm":"7.8.0"},"gitHead":"be330f058c2266dffbd4ee72630c588ebb95b9c6","_id":"@atek-cloud/json-schema-to-dts@1.5.0","_nodeVersion":"16.1.0","_npmVersion":"7.11.2","dist":{"integrity":"sha512-L7y0JntV1Wu1K0n3KklkV8GdgAsyf1stM/3VFGXsjm9qjKPQGXZwikTu73wy6oVXzbikGT1m40N28GZTCYxpHw==","shasum":"0b595d48772431d6e72082f74bc8c83da0c0a213","tarball":"https://registry.npmjs.org/@atek-cloud/json-schema-to-dts/-/json-schema-to-dts-1.5.0.tgz","fileCount":8,"unpackedSize":244882,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhFqAeCRA9TVsSAnZWagAA1oYQAJyKH1C1Y3zFMcZSN4mz\nE/R82DXqqw3zeeQeCNqk5lKwQcEdrNqENt89u5R675vjKYVrTLm5SOCpoftc\ngsha71VyAm984XvocPzVKT937OIJu8ZysXWml7KDFfcnFv4H/bQv9q3nh6GW\n0u3LRo++jvFkcD4WoD8WCwAsnxbs5kwgoNdTkiw4SkQgsVZSDfCd42D6ui/B\nlkq14JzEYFKIT3Nh4LGQmkrLz1DvMu3Zqusn8cGRc6m37Nons45b4deJghZa\nmONdXDqatcPbKpOu1S4YcU0ugDQQKkj1XB6ljsFovlpUto9hgFDgIaHQBzgP\njBNbVJUuFpOEqI8Ch4cNlQuoohQKKKcIjjiMsaJ+0CMJ55UOH6LKs7Yj94CJ\nN3I3zge8lWBFOo8a8ROy6jeg2ANl1mrj2IGDcx2SXFdh/ufNKUtEAaWR574R\nWEneTvuUAE4fDzT+RFZjXbfkn6QQcWHoLIoHlNx6deCaciEk3VvyG2pFQX9R\ntLLzlmI7wauvR4r83CV/Fyj0mFrSyvyRX7pypUvW6aQ3KDneJGU5AX4x7RHg\nngu9tGnh1kx4/zVfCuSWBLX2TillfcMZR4yK0m543blqyBpT7D/Wjkxkcqot\n28/AbnnwHuP9Mf2KIs1FyQabEePkXJTdpc+eotorVkAk5a43e2J0KOpb+u2A\nAnNA\r\n=PvpF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC8inqJ8zjYbk19Xlzph4sq5MaIF8CbsfIa2Oc694NH6QIgWv2aTSh5u1iJSkZMXYJWDj5PGQGDiwyjeyMURbeXAyA="}]},"_npmUser":{"name":"pfrazee","email":"pfrazee@gmail.com"},"directories":{},"maintainers":[{"name":"pfrazee","email":"pfrazee@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-schema-to-dts_1.5.0_1628872734465_0.9050655600152004"},"_hasShrinkwrap":false}},"time":{"created":"2021-08-13T16:38:54.420Z","1.5.0":"2021-08-13T16:38:54.650Z","modified":"2022-04-04T16:03:03.050Z"},"maintainers":[{"name":"pfrazee","email":"pfrazee@gmail.com"}],"description":"Create TypeScript types from json-schema v7","homepage":"https://github.com/ggoodman/json-schema-to-dts#readme","keywords":[],"repository":{"type":"git","url":"git+https://github.com/ggoodman/json-schema-to-dts.git"},"author":{"name":"Geoffrey Goodman"},"bugs":{"url":"https://github.com/ggoodman/json-schema-to-dts/issues"},"license":"MIT","readme":"# json-schema-to-dts\n\nConvert JSON Schema definitions into accurate (as possible) TypeScript\ndefinitions, specifying how the main schema types and lifted sub-schemas should\nbe declared / exported.\n\n## Example\n\nGiven the schema\n\n```json\n{\n  \"type\": \"object\",\n  \"properties\": {\n    \"name\": { \"type\": \"string\", \"description\": \"The name of an object\" },\n    \"not_annotated\": { \"type\": \"null\" },\n    \"command\": {\n      \"oneOf\": [\n        { \"const\": \"a constant!\" },\n        { \"enum\": [\"multiple\", { \"options\": \"are allowed\" }] }\n      ]\n    }\n  }\n}\n```\n\nAnd these options:\n\n```ts\nconst options = {\n  topLevel: {\n    isExported: true,\n  },\n};\n```\n\nWe get the following result:\n\n```ts\ntype JSONPrimitive = boolean | null | number | string;\ntype JSONValue =\n  | JSONPrimitive\n  | JSONValue[]\n  | {\n    [key: string]: JSONValue;\n  };\nexport type Test = {\n  /** The name of an object */\n  name?: string;\n  not_annotated?: null;\n  command?:\n    | \"a constant!\"\n    | (\n      | \"multiple\"\n      | {\n        options: \"are allowed\";\n      }\n    );\n};\n```\n\n## API\n\n### `new Parser()`\n\nProduce a new `Parser` instance.\n\n#### `.addSchema(uri, schema)`\n\nAdd a schema to the parser where:\n\n- `uri` - is a string representing the schema's uri (ie:\n  `file:///path/to/schema.json`)\n- `schema` - is the json object representation of the schema\n\n#### `.compile(options)`\n\nCompile all added schemas where:\n\n- `topLevel` - options for root schemas\n  - `hasDeclareKeyword` - _(optional)_ mark the type declaration as `declare`\n  - `isExported` - _(optional)_ `export` the type declaration\n- `lifted` - options for sub-schemas that have been lifted during compilation\n  - `hasDeclareKeyword` - _(optional)_ mark the type declaration as `declare`\n  - `isExported` - _(optional)_ `export` the type declaration\n- `sourceFile` - _(optional)_ existing source file to add the types to\n\nReturns an object `{ diagnostics, text }` where:\n\n- `diagnostics` - is an array of diagnostics\n- `text` - is the resulting typescript definitions\n","readmeFilename":"README.md"}