{"id":13455399,"url":"https://github.com/horiuchi/dtsgenerator","last_synced_at":"2025-05-15T04:06:58.839Z","repository":{"id":21921152,"uuid":"25245393","full_name":"horiuchi/dtsgenerator","owner":"horiuchi","description":"TypeScript d.ts file generate from JSON Schema file","archived":false,"fork":false,"pushed_at":"2024-07-28T15:14:09.000Z","size":2359,"stargazers_count":584,"open_issues_count":23,"forks_count":93,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-27T07:38:01.065Z","etag":null,"topics":["json-schema","opneapi","swagger","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/horiuchi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"SupportedFeatures.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["horiuchi"]}},"created_at":"2014-10-15T08:20:24.000Z","updated_at":"2025-04-24T12:54:15.000Z","dependencies_parsed_at":"2024-05-31T03:52:42.687Z","dependency_job_id":"24c69cc4-4a61-4c04-91d3-4f9b93e34060","html_url":"https://github.com/horiuchi/dtsgenerator","commit_stats":{"total_commits":848,"total_committers":47,"mean_commits":18.04255319148936,"dds":"0.35023584905660377","last_synced_commit":"358ecc586acdf02786333fa943247f7b9a462305"},"previous_names":[],"tags_count":90,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horiuchi%2Fdtsgenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horiuchi%2Fdtsgenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horiuchi%2Fdtsgenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horiuchi%2Fdtsgenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/horiuchi","download_url":"https://codeload.github.com/horiuchi/dtsgenerator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251961988,"owners_count":21671963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json-schema","opneapi","swagger","typescript"],"created_at":"2024-07-31T08:01:04.930Z","updated_at":"2025-05-15T04:06:53.826Z","avatar_url":"https://github.com/horiuchi.png","language":"TypeScript","funding_links":["https://github.com/sponsors/horiuchi"],"categories":["TypeScript","typescript"],"sub_categories":[],"readme":"# dtsgenerator\n\nTypeScript d.ts file generator from JSON Schema file or OpenAPI(Swagger) spec file.\n\n[![nodejs version](https://img.shields.io/node/v/dtsgenerator.svg)](#)\n[![npm version](https://badge.fury.io/js/dtsgenerator.svg)](https://www.npmjs.com/package/dtsgenerator)\n[![Build Status](https://github.com/horiuchi/dtsgenerator/actions/workflows/workflow-ci.yaml/badge.svg)](https://github.com/horiuchi/dtsgenerator/actions/workflows/workflow-ci.yaml)\n[![Coverage Status](https://coveralls.io/repos/github/horiuchi/dtsgenerator/badge.svg?branch=master)](https://coveralls.io/github/horiuchi/dtsgenerator?branch=master)\n[![npm download count](https://img.shields.io/npm/dt/dtsgenerator.svg)](https://www.npmjs.com/package/dtsgenerator)\n[![Stake to support us](https://badge.devprotocol.xyz/0x68c824db5A1634940BB838468Ff2aee2bDa5794B/descriptive)](https://stakes.social/0x68c824db5A1634940BB838468Ff2aee2bDa5794B)\n[![MIT license](https://img.shields.io/npm/l/dtsgenerator.svg)](#)\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Migration from v2](#migration-from-v2)\n- [Plug-in](#plug-in)\n- [Development](#development)\n- [ChangeLog](#changelog)\n- [License](#license)\n\n## Install\n\n    npm install -g dtsgenerator\n\n- [Releases](https://github.com/horiuchi/dtsgenerator/releases)\n\n## Usage\n\n### CLI\n\n```sh\n$ dtsgen --help\nUsage: dtsgenerator [options] \u003cfile ... | file patterns using node-glob\u003e\n\nOptions:\n  -V, --version           output the version number\n  -c, --config \u003cfile\u003e     set configuration file path.\n  --url \u003curl\u003e             input json schema from the url. (default: [])\n  --stdin                 read stdin with other files or urls.\n  -o, --out \u003cfile\u003e        output filename.\n  -t, --target \u003cversion\u003e  Specify ECMAScript target version: 'ES3', 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018',\n                          'ES2019', 'ES2020', or 'ESNEXT' (default).\n  --info                  for developer mode. output loaded config and plugin details only.\n  --output-ast            output TypeScript AST instead of d.ts file.\n  -h, --help              display help for command\n\nExamples:\n  $ dtsgen --help\n  $ dtsgen --out types.d.ts schema/**/*.schema.json\n  $ cat schema1.json | dtsgen -c dtsgen.json\n  $ dtsgen -o swaggerSchema.d.ts --url https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v2.0/schema.json\n  $ dtsgen -o petstore.d.ts --url https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/yaml/petstore.yaml\n  $ dtsgen -c dtsgen-test.json --info\n\n```\n\nFor the configuration file, please refer to the file in the [config_sample](https://github.com/horiuchi/dtsgenerator/tree/master/config_sample/) directory.\n\n### NodeJS API\n\n```js\nconst { default: dtsgenerator, parseSchema } = require('dtsgenerator');\n\ndtsgenerator({\n    contents: [parseSchema({/* JsonSchema object */})],\n    config: {/* Config object */},\n}).then(content =\u003e {\n    /* Do someting with parsed content */\n}).catch(err =\u003e {\n    /* Handle errors */\n});\n```\n\n### Use HTTP/HTTPS Proxy\n\nIf you need a proxy to fetch the schema, please set the following environment variables.\n\n```bash\nexport http_proxy=http://proxy.example.com:8080/\nexport https_proxy=http://proxy.example.com:8080/\n# If there are exceptionally hosts that do not go through a proxy\nexport no_proxy=google.com, yahoo.com\n```\n\n## Migration from v2\n\nThe dtsgenerator v3 has made the following breaking changes from v2.\n\n- Support Plug-in feature. See the Plug-in section for more information.\n- Change the command line options.\n  - Remove the `--namespace` option. Use the `@dtsgenerator/replace-namespace` plug-in instead.\n  - Add the `--config` option. Mainly for setting up the Plug-in.\n  - And add more options.\n- TypeScript AST is now used internally to generate type definitions.\n\n## Plug-in\n\n### How to find plug-in\n\n- Search by npm: \u003chttps://www.npmjs.com/search?q=dtsgenerator%20plugin\u003e\n- Find by the @dtsgenerator repositories: \u003chttps://github.com/dtsgenerator\u003e\n  - `@dtsgenerator/replace-namespace` : This plug-in is instead the `--namespace` option on old version.\n  - `@dtsgenerator/decorate-typename` : This plug-in can decorate the output type name.\n  - `@dtsgenerator/single-quote` : This plug-in replace the quote mark to single.\n\n### How to create plug-in\n\n1. Scaffold by the command:\n    - `npm init @dtsgenerator **plugin-name**`\n1. Edit `**plugin-name**/index.ts`\n1. Do test:\n    - `npm test`\n1. Build it:\n    - `npm run build`\n1. Publish to npm:\n    - `npm publish`\n\n## Development\n\n### Debug\n\nOutput debug message by [debug](https://www.npmjs.com/package/debug) library.\n\n    DEBUG=dtsgen dtsgen schema/news.json\n\n### Links about JSON Schema and Swagger\n\n- [The home of JSON Schema](http://json-schema.org/)\n- [The OpenAPI Specification](https://github.com/OAI/OpenAPI-Specification)\n\n### Supported spec and features\n\n- JSON Schema\n  - Draft-04 and before\n  - Draft-07 and before\n- OpenAPI\n  - OpenAPI Specification version 2.0\n  - OpenAPI Specification version 3.0\n\n- [supported features in these spec](https://github.com/horiuchi/dtsgenerator/blob/master/SupportedFeatures.md)\n\n## ChangeLog\n\n### [v3.19.2](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.19.2) (2024-06-11)\n\n- fixed:\n  - Support a negative number by #566. Thank you @maximebiloe :+1:\n\n### [v3.19.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.19.1) (2023-08-25)\n\n- features:\n  - Update plugins for new TypeScript AST.\n  - Changed supported Node.js version to 16 or later. Also, we have confirmed that it works with Node.js v20.\n\n### [v3.18.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.18.0) (2023-03-02)\n\n- features:\n  - Support 'application/json' with parameter media type for #551. Thank you @denizkenan :+1:\n\n### [v3.17.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.17.0) (2023-02-21)\n\n- features:\n  - Return exit code 1 when error occurs by #549. Thank you @lhotamir :+1:\n\n### [v3.16.2](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.16.2) (2022-12-20)\n\n- fixed:\n  - Fix to remove deprecated decorators parameters for #547. Thank you @mcollina :+1:\n\n### [v3.16.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.16.0) (2022-06-10)\n\n- features:\n  - Support 'image/*' media types for #539. Thank you @Geloosa :+1:\n\n### older versions history\n\n[ChangeLogs](https://github.com/horiuchi/dtsgenerator/blob/master/CHANGELOG.md)\n\n## License\n\n`dtsgenerator` is licensed under the MIT license.\n\nCopyright \u0026copy; 2016-2020, [Hiroki Horiuchi](mailto:horiuchi.g@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoriuchi%2Fdtsgenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoriuchi%2Fdtsgenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoriuchi%2Fdtsgenerator/lists"}