{"id":13727123,"url":"https://github.com/grantila/ts-to-openapi","last_synced_at":"2025-04-13T18:34:09.687Z","repository":{"id":54283659,"uuid":"235390112","full_name":"grantila/ts-to-openapi","owner":"grantila","description":"Convert TypeScript types to OpenAPI schema components","archived":false,"fork":false,"pushed_at":"2024-04-20T06:07:36.000Z","size":20,"stargazers_count":57,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-17T01:34:25.513Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/grantila.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}},"created_at":"2020-01-21T16:37:47.000Z","updated_at":"2024-07-14T09:15:49.000Z","dependencies_parsed_at":"2024-06-19T02:51:11.317Z","dependency_job_id":"a7965c15-9a03-45bf-9a8b-9e0c1538a833","html_url":"https://github.com/grantila/ts-to-openapi","commit_stats":{"total_commits":18,"total_committers":3,"mean_commits":6.0,"dds":"0.16666666666666663","last_synced_commit":"389e2781c9ba26d0cb1bfd2ae5a06ffa861a7635"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grantila%2Fts-to-openapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grantila%2Fts-to-openapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grantila%2Fts-to-openapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grantila%2Fts-to-openapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grantila","download_url":"https://codeload.github.com/grantila/ts-to-openapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248760651,"owners_count":21157402,"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":[],"created_at":"2024-08-03T01:03:40.427Z","updated_at":"2025-04-13T18:34:09.650Z","avatar_url":"https://github.com/grantila.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"[![npm version][npm-image]][npm-url]\n[![downloads][downloads-image]][npm-url]\n[![build status][build-image]][build-url]\n[![coverage status][coverage-image]][coverage-url]\n\n# ts-to-openapi\n\n*This package is not heavily maintained, and will be replaced with [typeconv](https://github.com/grantila/typeconv/)*\n\nThis package converts TypeScript interfaces and types to OpenAPI/Swagger YAML.\n\nIt can detect what looks like GraphQL-to-TypeScript converted files, and clean them up (e.g. auto-expanding `Scalar` and `Maybe`).\n\nThe result is a set of schema components which can be referred to in OpenAPI/Swagger routes (or from other components).\n\n\n# Example\n\nThe following converts types `MyTypeA` and `MyTypeB` in `my-file.ts` into OpenAPI YAML and writes to stdout:\n```\n$\u003e ts-to-openapi -f my-file.ts -t MyTypeA,MyTypeB\n```\n\n# Usage\n\n```\n   Usage: ts-to-openapi [options]\n\n   Convert TypeScript types and interfaces to OpenAPI YAML\n\n   Options:\n\n      -h, --help                                          Print (this) help screen\n      -v, --version                                       Print the program version\n      -f, --file \u003cfile\u003e                                   .ts file to read\n      -c, --config \u003cconfig\u003e                               Config file to use. Defaults to .ts-to-openapirc in the root of the project.\n      --tsconfig \u003ctsconfig\u003e                               tsconfig.json file to use. Defaults to the first found in parent directories of PWD.\n      --(no-)sort-props                                   Sort the properties in the types (default: true)\n      --(no-)as-comment                                   Output OpenAPI YAML inside a source code comment /* ... */ (default: true)\n      --(no-)type-check                                   Type-check the input file and fail on type errors (default: true)\n      --(no-)detect-graphql                               Auto-expand GraphQL types (e.g. Maybe, Scalar) and remove __typename (default: true)\n      --graphql-expanded-types \u003cgraphql-expanded-types\u003e   Define which GraphQL types to expand (replaces the built-in list)\n      --graphql-remove-props \u003cgraphql-remove-props\u003e       Define which GraphQL properties to remove (replaces the built-in list)\n      --expand-types \u003cexpand-types\u003e                       Additional types to expand rather than include as their own types\n      --remove-props \u003cremove-props\u003e                       Additional properties to remove from types\n      -t, --types \u003ctypes\u003e                                 The types to convert to OpenAPI\n      --json-format                                       Leave output as JSON\n      --model-version \u003csemantic-version\u003e                  Specify a semantic version for the model\n```\n\n\n[npm-image]: https://img.shields.io/npm/v/ts-to-openapi.svg\n[npm-url]: https://npmjs.org/package/ts-to-openapi\n[downloads-image]: https://img.shields.io/npm/dm/ts-to-openapi.svg\n[build-image]: https://img.shields.io/github/workflow/status/grantila/ts-to-openapi/Master.svg\n[build-url]: https://github.com/grantila/ts-to-openapi/actions?query=workflow%3AMaster\n[coverage-image]: https://coveralls.io/repos/github/grantila/ts-to-openapi/badge.svg?branch=master\n[coverage-url]: https://coveralls.io/github/grantila/ts-to-openapi?branch=master\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrantila%2Fts-to-openapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrantila%2Fts-to-openapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrantila%2Fts-to-openapi/lists"}