{"_id":"io-ts-to-json-schema","_rev":"3-c1de88539975868d113ca704602c03a0","name":"io-ts-to-json-schema","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.1":{"name":"io-ts-to-json-schema","version":"0.1.1","author":{"name":"kazana.grzegorz@gmail.com"},"license":"MIT","description":"Understandable io-ts error reports.","keywords":["io-ts","json","schema","json-schema","validation"],"repository":{"type":"git","url":"git+https://github.com/GrzegorzKazana/io-ts-to-json-schema.git"},"main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/types/index.d.ts","scripts":{"dev":"tsc --watch","build":"tsc && tsc -p tsconfig.cjs.json","test":"jest","test:watch":"jest --watch","prepublishOnly":"npm run build"},"devDependencies":{"@types/jest":"^27.0.2","conditional-type-checks":"^1.0.5","fast-check":"^2.18.0","fp-ts":"^2.11.5","io-ts":"^2.2.16","jest":"^27.3.1","json-schema-faker":"^0.5.0-rcv.40","ts-jest":"^27.0.7","ts-node":"^10.3.1","typescript":"^4.4.4"},"dependencies":{"@types/json-schema":"^7.0.9"},"peerDependencies":{"fp-ts":"2.x","io-ts":"2.x"},"gitHead":"e8c14c5c7a83871e62af97bd044602238a205051","bugs":{"url":"https://github.com/GrzegorzKazana/io-ts-to-json-schema/issues"},"homepage":"https://github.com/GrzegorzKazana/io-ts-to-json-schema#readme","_id":"io-ts-to-json-schema@0.1.1","_nodeVersion":"16.13.0","_npmVersion":"8.1.3","dist":{"integrity":"sha512-s40Y8/Sm/5Q9w9jnFb+IAFDoEeghVylWeEVa1nzSF6uF8jTsx24mwff26GrMAxn+Le/alfPjBDqQUbVMkZHbAg==","shasum":"3128f5c91b89129ba2a27ba3033ef639a66130d2","tarball":"https://registry.npmjs.org/io-ts-to-json-schema/-/io-ts-to-json-schema-0.1.1.tgz","fileCount":11,"unpackedSize":36575,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhyyXQCRA9TVsSAnZWagAAZm4P/iGVTMSvrvIb+M0MwjVm\nGdZTOT+wwUiA70btd2NVTHHTzV20MK/kT0oX74ybWQ86qwzQYYwXNGD4Tk1z\n7PdihsmwKTjvVmSC18QyImZWqgHODg5H1O/QexbgVc3g+tdHQkLSMMmY0FAm\nfnXrp7+LcylGB7b6Fn796chLoHOzhhlv03tlcgUX6dZkGc1nueRElw0HVsgx\nyCV+iBZQw8WCEn14R9eTR2KowokDnO9V2xiM/cBW1Im5IfiVtBuzd7zOW5Zp\nF3776QFKtNSoxuiAJn6mdAyqKfHZ9EA82r54qICzvvpdAUcYagCEODKNRrub\nyZzPYN5w/lvkKBZbepK4p+9iVtsrHvUTJp3eS8+s8wVkzMN14BQyFFkNCw++\nzVWiMvN5VyBhrQhGQhCEt+UDVnQTRy7fiZMHtiNGuXNCfsPM4tYhieATfM4T\nqPvw8IEcMhWgujLHpT7aQ6q3M+4daAO0XQEnZMTX+aTaX53knIwcG3RhudPR\nIsJMow7Jj4fkaogcqxBPaocYp4CaVG5ZfxDHF4UP6uHLQzUhLfv8/6Svd3b8\nuuTWuLteBQcqSZ8k3NT/fT1x0yoLAy9Oz4TggS7vhAjdGdzbaYxIt/bTLuxA\njvSQNwqeGxOrc9W5ohUhUP0Nuz6IwaVYFmwwpll2OWnV/lkU+1SGWpqh3Ibg\nlJyN\r\n=/Cry\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA8/NdKWIRn3YNHD4P3qN4oGqL4EaOoMPBGnOVx2DAPjAiABWU4JqAKWjU3mt5UXIkDypPSol1Saz/WhqEihk9P2WQ=="}]},"_npmUser":{"name":"grzegorz-kazana","email":"kazana.grzegorz@gmail.com"},"directories":{},"maintainers":[{"name":"grzegorz-kazana","email":"kazana.grzegorz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/io-ts-to-json-schema_0.1.1_1640703440391_0.18295978708051086"},"_hasShrinkwrap":false},"0.1.2":{"name":"io-ts-to-json-schema","version":"0.1.2","author":{"name":"kazana.grzegorz@gmail.com"},"license":"MIT","description":"Understandable io-ts error reports.","keywords":["io-ts","json","schema","json-schema","validation"],"repository":{"type":"git","url":"git+https://github.com/GrzegorzKazana/io-ts-to-json-schema.git"},"main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/types/index.d.ts","scripts":{"dev":"tsc --watch","build":"tsc && tsc -p tsconfig.cjs.json","test":"jest","test:watch":"jest --watch","prepublishOnly":"npm run build"},"devDependencies":{"@types/jest":"^27.0.2","conditional-type-checks":"^1.0.5","fast-check":"^2.18.0","fp-ts":"^2.11.5","io-ts":"^2.2.16","jest":"^27.3.1","json-schema-faker":"^0.5.0-rcv.40","ts-jest":"^27.0.7","ts-node":"^10.3.1","typescript":"^4.4.4"},"dependencies":{"@types/json-schema":"^7.0.9"},"peerDependencies":{"fp-ts":"^2.0.0","io-ts":"^2.0.0"},"gitHead":"273c5ed9861ca3c890d2372b233390f292ac2d1f","bugs":{"url":"https://github.com/GrzegorzKazana/io-ts-to-json-schema/issues"},"homepage":"https://github.com/GrzegorzKazana/io-ts-to-json-schema#readme","_id":"io-ts-to-json-schema@0.1.2","_nodeVersion":"16.13.0","_npmVersion":"8.1.3","dist":{"integrity":"sha512-isIITNr/RRPFJKYMTvf4ArJXcB530WDkzm8DBPwaSEfp5QLV1YKbaBY+/Nsr4hFa/VgUgwyOhQ5pFypZGgJ6CQ==","shasum":"209cdca8c7585e5f9dc6d50f7ba0f55f90d2c3db","tarball":"https://registry.npmjs.org/io-ts-to-json-schema/-/io-ts-to-json-schema-0.1.2.tgz","fileCount":11,"unpackedSize":36581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh0/M0CRA9TVsSAnZWagAABfcP/2ka7epy69Tf5pKSHYUI\nOnJMh3U+yT2Cl2YNSjgT4/Y+Da8ndq4+BpJPMjTmR7/WlyFbRuKx+U6EcM98\nyRtgg/alo+RmO51/QntFOZRQpiZLmCcC5Bvo/IPBodxbwpjw0Hb/RT43DGAx\n7YPIBc/PYpqrGuPN/wuqDoCg0/OMU48f1NIKO86T7IPyOJes8lrGdBIZ+Odq\nTYRTOWVKGg9+tq9eySj+PFjdmiDG/Nak2sVLTyvDo0uPVeg2mnnlW0Vpnqog\nR342qgyO2N9WVV/Z/XvpFU0d1SH7uXbrSBXchsyUG3EDMh0NuzQoYjebr7o0\n2zLgCgzQLqkLz2vxFQFeRY9rdvmYFuZdne01VTshaEWcUWxqeg2N2KkHoTIm\nPmr10yBGQOYr7XhpgsgSlm5G41cNBJt8aCbT3yYd2NE/yL4p6Sxl+9KkK5MU\n/IAc5Aw3eohyzpT1/Gba9K2UW14BONzFjMgHo2jya51U8nE2MlHb4RRp4ohA\nUEaFJVIdydk+INCacKxj7oqLVW/pytefauyFqdlGIgM41fKrUxlE2bBNn9dj\nKaDnaJurvJ2ioAJU46eJ1JIfAHDnwJMcRjzu6Kxu9+8Wki+bXMIID2TpsdrA\noOV2MCBjTD5XK+mkyQTx20s1HgIYNYyUSHY74WgEVtzuYsdUBzS3Ih8bvWmq\nW2Jp\r\n=ax+2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF1rCQT8pNol3vGadAbFCjOOblppPiw1XUjX0jGZans2AiBkAQnvRIPQChtYaoGHPl1e26T8eQdUTvjSLMlJq3CKPg=="}]},"_npmUser":{"name":"grzegorz-kazana","email":"kazana.grzegorz@gmail.com"},"directories":{},"maintainers":[{"name":"grzegorz-kazana","email":"kazana.grzegorz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/io-ts-to-json-schema_0.1.2_1641280307887_0.7228375672599916"},"_hasShrinkwrap":false},"0.2.0":{"name":"io-ts-to-json-schema","version":"0.2.0","author":{"name":"kazana.grzegorz@gmail.com"},"license":"MIT","description":"Understandable io-ts error reports.","keywords":["io-ts","json","schema","json-schema","validation"],"repository":{"type":"git","url":"git+https://github.com/GrzegorzKazana/io-ts-to-json-schema.git"},"main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/types/index.d.ts","scripts":{"dev":"tsc --watch","build":"tsc && tsc -p tsconfig.cjs.json","test":"jest","test:watch":"jest --watch","prepublishOnly":"npm run build"},"devDependencies":{"@types/jest":"^27.0.2","conditional-type-checks":"^1.0.5","fast-check":"^2.18.0","fp-ts":"^2.11.5","io-ts":"^2.2.16","jest":"^27.3.1","json-schema-faker":"^0.5.0-rcv.40","ts-jest":"^27.0.7","ts-node":"^10.3.1","typescript":"^4.4.4"},"dependencies":{"@types/json-schema":"^7.0.9"},"peerDependencies":{"fp-ts":"^2.0.0","io-ts":"^2.0.0"},"gitHead":"a64ca20de5e8b17ab98f2d6af6418f3cda3752ae","bugs":{"url":"https://github.com/GrzegorzKazana/io-ts-to-json-schema/issues"},"homepage":"https://github.com/GrzegorzKazana/io-ts-to-json-schema#readme","_id":"io-ts-to-json-schema@0.2.0","_nodeVersion":"16.13.0","_npmVersion":"8.1.3","dist":{"integrity":"sha512-M+mxEfbLAKM5U15eRAffDFjigp3y9GpSRYPEIX4r1v0KmnSeXZGrRDgfCrS9wOgXoaXlfG+/McfYZlWxIuWx4A==","shasum":"658a65d8e96995a036eae7d8b0ca4ee3be5bf26f","tarball":"https://registry.npmjs.org/io-ts-to-json-schema/-/io-ts-to-json-schema-0.2.0.tgz","fileCount":11,"unpackedSize":37828,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh1B8wCRA9TVsSAnZWagAAy2QP/Agi4V3r2bFrD181m2Uy\nG6H0y4XCg0HXqEptK04fYiu5Np5BCS7YJCrTxT72aqBEfmZvkKxl61pEkmz+\nqJEzmKlwqEAddJ7z1CulEnxsgc0NE7V7Zppi7QwBvG/ewxDhRsWyBqPRQswE\nt/88uKs96dKPkngRXMTTJKF/TCM4IKuiZ+I3uqOYATeaBVijYWmxAwiyDbL6\nvCU6tSqgG16Raw6w9Sq5pEm4aDnX3+VJRlPhyOK3sTTH2V/+W1JV1g5Iw9xe\nF2OZQjudpfmJ8h/0RSM17GN3gqBBvQMdwrotSxYbFymBAruhneKzbSG5hpVX\n0PxRfGNIs4zS7ad0odNrblVX9X85extkTaUW9V5kbZ6YmziVQazOwn0zvskb\nP9b1AzNByHl7HaWh1llCfI2KPPdNfZo1Z899tXe9IgjtpHMUFQuSO9sGqeip\nndJKToqTitIDJltaC5ewDxOrMxkzVIRu4p3tejcTjzyxu1xI+CvJzHifLPM7\n6OE1BVewdCwKxhChY5buQDhrCZaT+rkf6gaOZk6/Oeb3aV2mi0cmSxSMQ4sY\noJ3cEwY3SY7ulklUN5dkeFFZozkZLWMpsE1ABA9RKbv3+anknWRBcLs9FtSt\nt1IdP9kiyk/5CBdzzn/PNlVvhHreNSWDIMq20cJ2aFvIHICSiylQXrD/d9eo\nbzQc\r\n=oH1b\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCY+FDHsk3dxVHUtyMDtSa/wB9vIz6HNjE2oxzN6QpD8QIhAJcLziNBD4U2SS49yF/cUOiekEJDqRrKWrQTDpCdDW9V"}]},"_npmUser":{"name":"grzegorz-kazana","email":"kazana.grzegorz@gmail.com"},"directories":{},"maintainers":[{"name":"grzegorz-kazana","email":"kazana.grzegorz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/io-ts-to-json-schema_0.2.0_1641291567922_0.7686492005383425"},"_hasShrinkwrap":false}},"time":{"created":"2021-12-28T14:57:20.390Z","0.1.1":"2021-12-28T14:57:20.510Z","modified":"2022-05-06T01:50:17.790Z","0.1.2":"2022-01-04T07:11:48.013Z","0.2.0":"2022-01-04T10:19:28.005Z"},"maintainers":[{"name":"grzegorz-kazana","email":"kazana.grzegorz@gmail.com"}],"description":"Understandable io-ts error reports.","homepage":"https://github.com/GrzegorzKazana/io-ts-to-json-schema#readme","keywords":["io-ts","json","schema","json-schema","validation"],"repository":{"type":"git","url":"git+https://github.com/GrzegorzKazana/io-ts-to-json-schema.git"},"author":{"name":"kazana.grzegorz@gmail.com"},"bugs":{"url":"https://github.com/GrzegorzKazana/io-ts-to-json-schema/issues"},"license":"MIT","readme":"# io-ts-to-json-schema\n\nTransform `io-ts` codecs to json schema.\n\nEscape hatch for interfacing [io-ts](https://github.com/gcanti/io-ts) and [json schema](https://json-schema.org/) validations.\n\n## usage/examples\n\n```bash\nnpm i io-ts-to-json-schema\n# fp-ts and io-ts are package peerDependencies\n# so make sure you have these also installed\n```\n\n```ts\nimport * as t from 'io-ts';\nimport { toJsonSchema } from 'io-ts-to-json-schema';\n\nconst codec = t.type({\n    a: t.string,\n    b: t.union([t.string, t.null]),\n});\n\ntoJsonSchema(codec);\n// {\n//     \"type\": \"object\",\n//     \"description\": \"{ a: string, b: (string | null) }\",\n//     \"properties\": {\n//         \"a\": {\n//             \"type\": \"string\",\n//             \"description\": \"string\"\n//         },\n//         \"b\": {\n//             \"anyOf\": [\n//                 {\n//                     \"type\": \"string\",\n//                     \"description\": \"string\"\n//                 },\n//                 {\n//                     \"type\": \"null\",\n//                     \"description\": \"null\"\n//                 }\n//             ],\n//             \"description\": \"(string | null)\"\n//         }\n//     },\n//     \"required\": [\n//         \"a\",\n//         \"b\"\n//     ]\n// }\n```\n\n## features\n\n-   ### built-in codec support table\n\n| codec             | status | comment                                                                                                                                                                                                                                                                      |\n| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `t.null`          | ✅     | -                                                                                                                                                                                                                                                                            |\n| `t.string`        | ✅     | -                                                                                                                                                                                                                                                                            |\n| `t.number`        | ✅     | -                                                                                                                                                                                                                                                                            |\n| `t.bigint`        | ⚠️     | treated like `number`                                                                                                                                                                                                                                                        |\n| `t.boolean`       | ✅     | -                                                                                                                                                                                                                                                                            |\n| `t.undefined`     | ⚠️     | unrepresentable in JSON, falls back to `{}`                                                                                                                                                                                                                                  |\n| `t.void`          | ⚠️     | unrepresentable in JSON, falls back to `{}`                                                                                                                                                                                                                                  |\n| `t.any`           | ⚠️     | unrepresentable in JSON, falls back to `{}`                                                                                                                                                                                                                                  |\n| `t.unknown`       | ⚠️     | unrepresentable in JSON, falls back to `{}`                                                                                                                                                                                                                                  |\n| `t.UnknownArray`  | ⚠️     | unrepresentable in JSON, falls back to `{ type: 'array', items: {} }`                                                                                                                                                                                                        |\n| `t.UnknownRecord` | ⚠️     | unrepresentable in JSON, falls back to `{ type: 'object' }`                                                                                                                                                                                                                  |\n| `t.Function`      | ⚠️     | unrepresentable in JSON, falls back to `{}`                                                                                                                                                                                                                                  |\n| `t.Refinement`    | ⚠️     | unrepresentable in JSON, falls back to `{}`                                                                                                                                                                                                                                  |\n| `t.literal`       | ✅     | -                                                                                                                                                                                                                                                                            |\n| `t.recursion`     | ✅     | due to single top down codec traversal, additional definitions may be placed in other places than root level `$deps`. see the [tests](https://github.com/GrzegorzKazana/io-ts-to-json-schema/blob/ecdeb80b5fea90c4824c58e668b6685cfc79440b/src/__tests__/index.test.ts#L113) |\n| `t.array`         | ✅     | -                                                                                                                                                                                                                                                                            |\n| `t.type`          | ✅     | -                                                                                                                                                                                                                                                                            |\n| `t.partial`       | ✅     | -                                                                                                                                                                                                                                                                            |\n| `t.record`        | ✅     | assumes domain is `string`                                                                                                                                                                                                                                                   |\n| `t.union`         | ✅     | -                                                                                                                                                                                                                                                                            |\n| `t.intersection`  | ✅     | -                                                                                                                                                                                                                                                                            |\n| `t.tuple`         | ✅     | -                                                                                                                                                                                                                                                                            |\n| `t.readonly`      | ✅     | -                                                                                                                                                                                                                                                                            |\n| `t.readonlyArray` | ✅     | -                                                                                                                                                                                                                                                                            |\n| `t.strict`        | ✅     | -                                                                                                                                                                                                                                                                            |\n| `t.keyof`         | ✅     | -                                                                                                                                                                                                                                                                            |\n| `t.exact`         | ✅     | -                                                                                                                                                                                                                                                                            |\n\n-   ### output customization\n\nEach node in the schema can be customized or completely replaced. This allows you to add support for your custom `t.Type`s.\n\n```ts\nconst codec = t.type(\n    {\n        a: t.string,\n        b: t.union([t.string, t.null], 'StringOrNull'),\n    },\n    'FooBar',\n);\n\nconst descriptions = {\n    FooBar: 'some description for foobar',\n    StringOrNull: 'some description for string | null',\n};\n\n// e.g. attaching custom descriptions\nconst schema = toJsonSchema(codec, {\n    customizer: (schema, codec, context) => ({\n        ...schema,\n        description: descriptions[codec.name],\n    }),\n});\n// {\n//     \"type\": \"object\",\n//     \"required\": [\n//         \"a\",\n//         \"b\"\n//     ],\n//     \"properties\": {\n//         \"a\": {\n//             \"type\": \"string\"\n//         },\n//         \"b\": {\n//             \"anyOf\": [\n//                 {\n//                     \"type\": \"string\"\n//                 },\n//                 {\n//                     \"type\": \"null\"\n//                 }\n//             ],\n//             \"description\": \"some description for string | null\"\n//         }\n//     },\n//     \"description\": \"some description for foobar\"\n// }\n```\n\n-   ### codec customization\n\nEach entered codec can be manipulated beforehand.\n\n```ts\nconst codec = t.type(\n    {\n        a: t.string,\n        b: t.union([t.string, t.null], 'StringOrNull'),\n    },\n    'FooBar',\n);\n\nconst schema = toJsonSchema(codec, {\n    codecCustomizer: codec => {\n        if (codec.name !== 'FooBar' || !(codec instanceof t.InterfaceType)) return codec;\n\n        // omit single field\n        const { a: _, ...props } = codec.props;\n\n        return t.type(props, codec.name);\n    },\n});\n// {\n//     \"type\": \"object\",\n//     \"required\": [\n//         \"b\"\n//     ],\n//     \"properties\": {\n//         \"b\": {\n//             \"anyOf\": [\n//                 {\n//                     \"type\": \"string\"\n//                 },\n//                 {\n//                     \"type\": \"null\"\n//                 }\n//             ]\n//         }\n//     },\n// }\n```\n","readmeFilename":"README.md"}