{"id":25015269,"url":"https://github.com/ditschedev/swag-ts","last_synced_at":"2026-02-26T05:15:31.703Z","repository":{"id":166379947,"uuid":"641864655","full_name":"ditschedev/swag-ts","owner":"ditschedev","description":"swag-ts is a simple and fast code generator written in Go that creates typescript interfaces and enums for your openapi specification.","archived":false,"fork":false,"pushed_at":"2025-12-19T10:49:48.000Z","size":42,"stargazers_count":2,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-22T03:56:58.031Z","etag":null,"topics":["awag-ts","cli","generator","hacktoberfest","openapi","openapi3","swagger","typescript"],"latest_commit_sha":null,"homepage":"","language":"Go","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/ditschedev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-05-17T10:22:08.000Z","updated_at":"2023-10-05T11:09:54.000Z","dependencies_parsed_at":"2024-05-07T20:23:52.851Z","dependency_job_id":"85432cef-ad6f-4228-a8e1-2d4a5a842089","html_url":"https://github.com/ditschedev/swag-ts","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/ditschedev/swag-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ditschedev%2Fswag-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ditschedev%2Fswag-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ditschedev%2Fswag-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ditschedev%2Fswag-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ditschedev","download_url":"https://codeload.github.com/ditschedev/swag-ts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ditschedev%2Fswag-ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29849339,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T22:37:40.667Z","status":"online","status_checked_at":"2026-02-26T02:00:06.774Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["awag-ts","cli","generator","hacktoberfest","openapi","openapi3","swagger","typescript"],"created_at":"2025-02-05T08:18:35.996Z","updated_at":"2026-02-26T05:15:31.674Z","avatar_url":"https://github.com/ditschedev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swag-ts\n\n[![](https://img.shields.io/github/actions/workflow/status/ditschedev/swag-ts/test.yml?branch=main\u0026longCache=true\u0026label=Test\u0026logo=github%20actions\u0026logoColor=fff)](https://github.com/ditschedev/swag-ts/actions?query=workflow%3ATest)\n[![Go Report Card](https://goreportcard.com/badge/github.com/ditschedev/swag-ts)](https://goreportcard.com/report/github.com/ditschedev/swag-ts)\n\nSimply provide a OpenAPI Specification and swag-ts will generate typescript types for you. You can provide json or yaml definitions on your local filesystem or a remote url.\n\n## Motivation\nWhy another type generator for OpenAPI (Swagger)? Well it's because I could not find a generator that only generates typescript types. \nMost generators also generate runtime code which I don't necessarily need. I just want to have the typescript types to use them in my frontend application.\n\nIf thats something for you, feel free to use it. If you need more functionality, feel free to open an issue or a pull request.\n\n## Installation\n\n```bash\ngo install github.com/ditschedev/swag-ts@latest\n```\n\n## Usage\n\n```bash\nUsage:\n  swag-ts [flags]\n\nFlags:\n  -f, --file string     file path or url to the OpenAPI Specification\n  -h, --help            help for swag-ts\n  -o, --output string   output file for generated definitions (default \"./types/swagger.ts\")\n  -v, --version         shows the version of the cli\n```\n\n## Format\nThis library aims to only provide typescript type definitions from a given OpenAPI Specification. It does not provide any runtime functionality.\nAll types are exported as `interface`.\n\nFor example, the following Schema:\n```yaml\nLoginResponse:\n  required:\n    - token\n  type: object\n  properties:\n    token:\n      minLength: 1\n      type: string\n  additionalProperties: false\n\nLoginResponseWrapper:\n  required:\n    - data\n  type: object\n  properties:\n    data:\n      $ref: '#/components/schemas/LoginResponse'\n    message:\n      type: string\n      nullable: true\n  additionalProperties: false\n```\n\nwill be converted to the following typescript definitions:\n```typescript\nexport interface LoginResponse {\n  token: string;\n}\n\nexport interface LoginResponseWrapper {\n  data: LoginResponse;\n  message?: string | null;\n}\n```\n\n### Enums\nEnums are converted to typescript enums. See the example below:\n```yaml\nCar:\n  required:\n    - manufacturer\n  type: object\n  properties:\n    manufacturer:\n      $ref: \"#/components/schemas/CarManufacturer\"\nCarManufacturer:\n  type: string\n  enum:\n    - BMW\n    - Mercedes\n    - Audi  \n```\n\nwill be converted to the following typescript definitions:\n```typescript\nexport interface Car {\n    manufacturer: CarManufacturer;\n}\n\nexport enum CarManufacturer {\n    BMW = \"BMW\",\n    Mercedes = \"Mercedes\",\n    Audi = \"Audi\",\n}\n```\n\n### FormData Requests\nIf you have a request with `multipart/form-data` content type the cli will generate a type definition as well.\nAs for most OpenAPI Specs the schema of the form data will not be added to the `schemas` section of the definition itself, rather than in the `requestBody` section of the `path`.\n\nThe generated type will be named after the operation id with a suffix of `FormData`. For converting this type to a `FormData` object you can use the `convertToFormData` function from the generated file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fditschedev%2Fswag-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fditschedev%2Fswag-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fditschedev%2Fswag-ts/lists"}