{"id":16294087,"url":"https://github.com/axetroy/swagger2ts","last_synced_at":"2025-03-20T04:30:27.910Z","repository":{"id":46577547,"uuid":"335892658","full_name":"axetroy/swagger2ts","owner":"axetroy","description":"💗 从 Swagger 生成优雅的 Typescript 代码. Generate elegant typescript code from swagger.","archived":false,"fork":false,"pushed_at":"2024-03-12T10:01:39.000Z","size":12455,"stargazers_count":24,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-14T01:15:52.033Z","etag":null,"topics":["deno","nodejs","swagger","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@axetroy/swagger2ts","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/axetroy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"github.com/axetroy/buy-me-a-cup-of-tea"}},"created_at":"2021-02-04T08:47:38.000Z","updated_at":"2024-02-10T19:10:58.000Z","dependencies_parsed_at":"2024-10-10T20:14:06.663Z","dependency_job_id":"173792ea-90f8-461a-97d0-798de6216e48","html_url":"https://github.com/axetroy/swagger2ts","commit_stats":{"total_commits":130,"total_committers":3,"mean_commits":"43.333333333333336","dds":"0.023076923076923106","last_synced_commit":"3b4ab978a96a22722b55d1b8affa372cdaa185b8"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axetroy%2Fswagger2ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axetroy%2Fswagger2ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axetroy%2Fswagger2ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axetroy%2Fswagger2ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/axetroy","download_url":"https://codeload.github.com/axetroy/swagger2ts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244047647,"owners_count":20389206,"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":["deno","nodejs","swagger","typescript"],"created_at":"2024-10-10T20:14:04.342Z","updated_at":"2025-03-20T04:30:27.443Z","avatar_url":"https://github.com/axetroy.png","language":"TypeScript","funding_links":["github.com/axetroy/buy-me-a-cup-of-tea"],"categories":[],"sub_categories":[],"readme":"中文简体 | [English](README_en-US.md)\n\n[![Build Status](https://github.com/axetroy/swagger2ts/workflows/test/badge.svg)](https://github.com/axetroy/swagger2ts/actions)\n\n从 swagger(v3) 的 JSON 文件生成 typescript 代码。\n\n它会生成 typescript 的声明和`基于 fetch` 的运行时。几乎开箱即用。\n\n它能够适用于绝大多数场景，强健你的接口调用，省去烦人的类型声明。\n\n这里有一些[生成好的精美例子](__test__/3.0)，看看是否符合您的胃口\n\n### 安装\n\n通过 [Deno](https://deno.land) 安装\n\n```typescript\ndeno install \\\n  -A \\\n  --no-check \\\n  --reload \\\n  -f \\\n  https://github.com/axetroy/swagger2ts/raw/v0.2.26/swagger2ts.ts\n```\n\n或者通过 [npm](https://npmjs.com) 安装\n\n```bash\nnpm install -g @axetroy/swagger2ts\n```\n\n### 使用\n\n### 使用命令行工具\n\n```bash\nswagger2ts swagger.json \u003e api.ts\nswagger2ts https://example.com/swagger.json \u003e api.ts\n```\n\n#### 通过 nodejs 函数调用\n\n```js\nimport { generate } from \"@axetroy/swagger2ts\";\n\nconst output = await generate(\"/path/to/swagger.json\");\n// const output = await generate(\"https://example.com/swagger.json\");\n\nconsole.log(output);\n```\n\n#### 通过 Deno 函数调用\n\n```ts\nimport { generate } from \"https://github.com/axetroy/swagger2ts/raw/v0.2.26/generate.ts\";\n\nconst output = await generate(\"/path/to/swagger.json\");\n// const output = await generate(\"https://example.com/swagger.json\");\n\nconsole.log(output);\n```\n\n## 开源许可\n\nThe [MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxetroy%2Fswagger2ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxetroy%2Fswagger2ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxetroy%2Fswagger2ts/lists"}