{"id":13554745,"url":"https://github.com/microsoft/typespec","last_synced_at":"2026-04-07T21:01:37.314Z","repository":{"id":37067637,"uuid":"381857226","full_name":"microsoft/typespec","owner":"microsoft","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-02T05:37:28.000Z","size":94068,"stargazers_count":5652,"open_issues_count":1110,"forks_count":350,"subscribers_count":51,"default_branch":"main","last_synced_at":"2026-04-02T06:13:10.987Z","etag":null,"topics":["json-schema","openapi3","protobuf","typespec"],"latest_commit_sha":null,"homepage":"https://typespec.io/","language":"Java","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/microsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","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":"2021-06-30T23:29:49.000Z","updated_at":"2026-04-02T00:46:47.000Z","dependencies_parsed_at":"2023-10-11T22:39:47.211Z","dependency_job_id":"07b467b0-4252-4a61-82d8-d6663d2964ec","html_url":"https://github.com/microsoft/typespec","commit_stats":{"total_commits":2871,"total_committers":109,"mean_commits":"26.339449541284402","dds":0.6161616161616161,"last_synced_commit":"3bd6a8758cb12b0f182c03d70f2c39781a0d84af"},"previous_names":["microsoft/cadl"],"tags_count":471,"template":false,"template_full_name":null,"purl":"pkg:github/microsoft/typespec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Ftypespec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Ftypespec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Ftypespec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Ftypespec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoft","download_url":"https://codeload.github.com/microsoft/typespec/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Ftypespec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31528751,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["json-schema","openapi3","protobuf","typespec"],"created_at":"2024-08-01T12:02:54.058Z","updated_at":"2026-04-07T21:01:37.300Z","avatar_url":"https://github.com/microsoft.png","language":"Java","readme":"# TypeSpec\n\n[Official Docs](https://typespec.io/) | [Try TypeSpec Online](https://aka.ms/trytypespec) | [Getting Started](https://typespec.io/docs) | [Language Overview](https://typespec.io/docs/language-basics/overview)\n\nTypeSpec is a language for defining cloud service APIs and shapes. TypeSpec is a highly extensible language with primitives that can describe API shapes common among REST, OpenAPI, gRPC, and other protocols.\n\nTypeSpec is excellent for generating many different API description formats, client and service code, documentation, and other assets while keeping your TypeSpec definition as a single source of truth.\n\nUsing TypeSpec, you can create reusable patterns for all aspects of an API and package those reusable patterns into libraries. These patterns establish \"guardrails\" for API designers and make it easier to follow best practices than to deviate from them. TypeSpec also has a rich linter framework with the ability to flag anti-patterns as well as an emitter framework that lets you control the output to ensure it follows the patterns you want.\n\nTypeSpec is a Microsoft-built, community-supported project. Your ideas, feedbacks, and code make all the difference and we deeply appreciate the support from the community.\n\n## [Installation](https://typespec.io/docs)\n\n```\nnpm install -g @typespec/compiler\n```\n\n#### Tools\n\nThe [TypeSpec VS Code extension](https://marketplace.visualstudio.com/items?itemName=typespec.typespec-vscode) can be installed from the VS Code [marketplace](https://marketplace.visualstudio.com/items?itemName=typespec.typespec-vscode) or directly on the command line:\n\n```\ntsp code install\n```\n\nThe [TypeSpec VS Extension](https://marketplace.visualstudio.com/items?itemName=typespec.typespecvs) can be installed from the [VS Marketplace](https://marketplace.visualstudio.com/items?itemName=typespec.typespecvs) or directly on the command line:\n\n```\ntsp vs install\n```\n\n## [Usage](https://typespec.io/docs#create-first-typespec-project)\n\n### TypeSpec to OpenAPI 3.0 Example\n\nThis example uses the `@typespec/http`, `@typespec/rest`, and `@typespec/openapi3` libraries to define a basic REST service and generate an OpenAPI 3.0 document from it.\n\nRun the following command and select \"Generic REST API\":\n\n```\ntsp init\n```\n\nHit enter a few times to confirm the defaults.\n\nCopy the contents below into your **main.tsp**:\n\n```typespec\nimport \"@typespec/http\";\nimport \"@typespec/rest\";\nimport \"@typespec/openapi3\";\n\nusing Http;\nusing Rest;\n\n/** This is a pet store service. */\n@service(#{ title: \"Pet Store Service\" })\n@server(\"https://example.com\", \"The service endpoint\")\nnamespace PetStore;\n\n@route(\"/pets\")\ninterface Pets {\n  list(): Pet[];\n}\n\nmodel Pet {\n  @minLength(100)\n  name: string;\n\n  @minValue(0)\n  @maxValue(100)\n  age: int32;\n\n  kind: \"dog\" | \"cat\" | \"fish\";\n}\n```\n\nInstall the dependencies of main.tsp:\n\n```\ntsp install\n```\n\nCompile it to OpenAPI 3.0:\n\n```\ntsp compile main.tsp --emit @typespec/openapi3\n```\n\nYou can find the emitted OpenAPI output in `./tsp-output/openapi.json`.\n\n## Advanced Scenarios\n\n### Installing nightly version\n\nOn every commit to the main branch, packages with changes are automatically published to npm with the `@next` tag.\nThe [packages](#packages) section shows which version corresponds to the `next` tag for each package.\n\nTo use a `nightly` version of the packages, go over each one of the packages in the `package.json` file and update it to either the latest published `@next` version or `@latest`, whichever is the newest. You can also use the tag `latest` or `next` instead of an explicit version.\n\nAfter updating the package.json file you can run `npm update --force`. Force is required as there might be some incompatible version requirement.\n\nExample\n\n```json5\n// Stable setup\n\"dependencies\": {\n  \"@typespec/compiler\": \"~0.30.0\",\n  \"@typespec/http\": \"~0.14.0\",\n  \"@typespec/rest\": \"~0.14.0\",\n  \"@typespec/openapi\": \"~0.9.0\",\n}\n\n// Consume next version\n// In this example: compiler and openapi have changes but rest library has none\n\"dependencies\": {\n  \"@typespec/compiler\": \"~0.31.0-dev.5\",\n  \"@typespec/http\": \"~0.14.0\",\n  \"@typespec/rest\": \"~0.14.0\", // No changes to @typespec/rest library so need to stay the latest.\n  \"@typespec/openapi\": \"~0.10.0-dev.2\",\n}\n```\n\n## Packages\n\n| Name                                               | Changelog                        | Latest                                                                                                                                   | Next                                                                      |\n| -------------------------------------------------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |\n| Core functionality                                 |                                  |                                                                                                                                          |                                                                           |\n| [@typespec/compiler][compiler_src]                 | [Changelog][compiler_chg]        | [![](https://img.shields.io/npm/v/@typespec/compiler)](https://www.npmjs.com/package/@typespec/compiler)                                 | ![](https://img.shields.io/npm/v/@typespec/compiler/next)                 |\n| TypeSpec Libraries                                 |                                  |                                                                                                                                          |                                                                           |\n| [@typespec/http][http_src]                         | [Changelog][http_chg]            | [![](https://img.shields.io/npm/v/@typespec/http)](https://www.npmjs.com/package/@typespec/http)                                         | ![](https://img.shields.io/npm/v/@typespec/http/next)                     |\n| [@typespec/rest][rest_src]                         | [Changelog][rest_chg]            | [![](https://img.shields.io/npm/v/@typespec/rest)](https://www.npmjs.com/package/@typespec/rest)                                         | ![](https://img.shields.io/npm/v/@typespec/rest/next)                     |\n| [@typespec/openapi][openapi_src]                   | [Changelog][openapi_chg]         | [![](https://img.shields.io/npm/v/@typespec/openapi)](https://www.npmjs.com/package/@typespec/openapi)                                   | ![](https://img.shields.io/npm/v/@typespec/openapi/next)                  |\n| [@typespec/openapi3][openapi3_src]                 | [Changelog][openapi3_chg]        | [![](https://img.shields.io/npm/v/@typespec/openapi3)](https://www.npmjs.com/package/@typespec/openapi3)                                 | ![](https://img.shields.io/npm/v/@typespec/openapi3/next)                 |\n| [@typespec/versioning][versioning_src]             | [Changelog][versioning_chg]      | [![](https://img.shields.io/npm/v/@typespec/versioning)](https://www.npmjs.com/package/@typespec/versioning)                             | ![](https://img.shields.io/npm/v/@typespec/versioning/next)               |\n| TypeSpec Tools                                     |                                  |                                                                                                                                          |                                                                           |\n| [@typespec/prettier-plugin-typespec][prettier_src] | [Changelog][prettier_chg]        | [![](https://img.shields.io/npm/v/@typespec/prettier-plugin-typespec)](https://www.npmjs.com/package/@typespec/prettier-plugin-typespec) | ![](https://img.shields.io/npm/v/@typespec/prettier-plugin-typespec/next) |\n| [typespec-vs][typespec-vs_src]                     | [Changelog][typespec-vs_chg]     | [![](https://img.shields.io/npm/v/typespec-vs)](https://www.npmjs.com/package/typespec-vs)                                               | ![](https://img.shields.io/npm/v/typespec-vs/next)                        |\n| [typespec-vscode][typespec-vscode_src]             | [Changelog][typespec-vscode_chg] | [![](https://img.shields.io/npm/v/typespec-vscode)](https://www.npmjs.com/package/typespec-vscode)                                       | ![](https://img.shields.io/npm/v/typespec-vscode/next)                    |\n| [tmlanguage-generator][tmlanguage_src]             | [Changelog][tmlanguage_chg]      | [![](https://img.shields.io/npm/v/tmlanguage-generator)](https://www.npmjs.com/package/tmlanguage-generator)                             | ![](https://img.shields.io/npm/v/tmlanguage-generator/next)               |\n\n[compiler_src]: packages/compiler\n[compiler_chg]: packages/compiler/CHANGELOG.md\n[http_src]: packages/http\n[http_chg]: packages/http/CHANGELOG.md\n[rest_src]: packages/rest\n[rest_chg]: packages/rest/CHANGELOG.md\n[openapi_src]: packages/openapi\n[openapi_chg]: packages/openapi/CHANGELOG.md\n[openapi3_src]: packages/openapi3\n[openapi3_chg]: packages/openapi3/CHANGELOG.md\n[versioning_src]: packages/versioning\n[versioning_chg]: packages/versioning/CHANGELOG.md\n[prettier_src]: packages/prettier-plugin-typespec\n[prettier_chg]: packages/prettier-plugin-typespec/CHANGELOG.md\n[typespec-vs_src]: packages/typespec-vs\n[typespec-vs_chg]: packages/typespec-vs/CHANGELOG.md\n[typespec-vscode_src]: packages/typespec-vscode\n[typespec-vscode_chg]: packages/typespec-vscode/CHANGELOG.md\n[tmlanguage_src]: packages/tmlanguage-generator\n[tmlanguage_chg]: packages/tmlanguage-generator/CHANGELOG.md\n\n`@next` version of the package are the latest versions available on the `main` branch.\n","funding_links":[],"categories":["others","Java","⚙️ Backend \u0026 APIs","TODO:","TypeScript","\u003ca name=\"Java\"\u003e\u003c/a\u003eJava"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Ftypespec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoft%2Ftypespec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Ftypespec/lists"}