{"id":19648037,"url":"https://github.com/0x-jerry/openapi-ts","last_synced_at":"2025-02-27T00:34:33.593Z","repository":{"id":213303307,"uuid":"733536849","full_name":"0x-jerry/openapi-ts","owner":"0x-jerry","description":"Openapi schema to client typescript code","archived":false,"fork":false,"pushed_at":"2025-02-26T13:42:24.000Z","size":416,"stargazers_count":0,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T14:38:32.694Z","etag":null,"topics":["generate-code","openapi","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/0x-jerry.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-12-19T14:49:52.000Z","updated_at":"2025-01-28T03:59:03.000Z","dependencies_parsed_at":"2023-12-19T18:02:53.623Z","dependency_job_id":"caab332b-51dd-4dcb-be4a-49ac01aba4c7","html_url":"https://github.com/0x-jerry/openapi-ts","commit_stats":null,"previous_names":["0x-jerry/openapi-ts"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x-jerry%2Fopenapi-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x-jerry%2Fopenapi-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x-jerry%2Fopenapi-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x-jerry%2Fopenapi-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0x-jerry","download_url":"https://codeload.github.com/0x-jerry/openapi-ts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240957442,"owners_count":19884733,"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":["generate-code","openapi","swagger","typescript"],"created_at":"2024-11-11T14:46:56.274Z","updated_at":"2025-02-27T00:34:33.565Z","avatar_url":"https://github.com/0x-jerry.png","language":"TypeScript","readme":"# OpenAPI Code Generator\n\nThis package provide a quick way to transform OpenAPI schema or Swagger schema to client typescript code.\n\n## Usage\n\n1. Generate client typescript code\n\n```ts\nimport { generate } from '@0x-jerry/openapi-ts'\n\nconst apiUrl = 'http://doc-url/api-docs'\n\nconst swaggerSchema = await (await fetch(apiUrl)).json()\n\nawait generate({\n  schema: swaggerSchema,\n  output: 'api/generated',\n  format: true,\n  clean: true,\n})\n```\n\n2. Implement custom API adapter `api/_adapter.ts`\n\n```ts\nimport { type RequestParams } from '@0x-jerry/openapi-ts/runtime'\n\nexport interface Config {\n  customOption?: any\n}\n\nexport const _request = async (data: RequestParams\u003cConfig\u003e) =\u003e {\n  const resp = await doRequest({\n    url: data.url,\n    method: data.method,\n    searchParams: data.query,\n    body: data.data,\n    config: data.config,\n  })\n\n  return resp\n}\n```\n\n3. Use generated code\n\n```ts\nimport * as api from './api/generated'\n\nconst resp = await api.segment.to.path.$get({...})\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x-jerry%2Fopenapi-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0x-jerry%2Fopenapi-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x-jerry%2Fopenapi-ts/lists"}