[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-71432":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":8,"language":10,"languages":8,"totalLinesOfCode":8,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":13,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":8,"rankLanguage":8,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":23,"topics":24,"createdAt":8,"pushedAt":8,"updatedAt":28,"readmeContent":29,"aiSummary":30,"trendingCount":15,"starSnapshotCount":15,"syncStatus":31,"lastSyncTime":32,"discoverSource":33},71432,"typespec","microsoft\u002Ftypespec","microsoft",null,"https:\u002F\u002Ftypespec.io\u002F","Java",5769,371,48,1059,0,4,15,12,38.71,"MIT License",false,"main",true,[25,26,27,5],"json-schema","openapi3","protobuf","2026-06-12 02:02:52","# TypeSpec\n\n[Official Docs](https:\u002F\u002Ftypespec.io\u002F) | [Try TypeSpec Online](https:\u002F\u002Faka.ms\u002Ftrytypespec) | [Getting Started](https:\u002F\u002Ftypespec.io\u002Fdocs) | [Language Overview](https:\u002F\u002Ftypespec.io\u002Fdocs\u002Flanguage-basics\u002Foverview)\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:\u002F\u002Ftypespec.io\u002Fdocs)\n\n```\nnpm install -g @typespec\u002Fcompiler\n```\n\n#### Tools\n\nThe [TypeSpec VS Code extension](https:\u002F\u002Fmarketplace.visualstudio.com\u002Fitems?itemName=typespec.typespec-vscode) can be installed from the VS Code [marketplace](https:\u002F\u002Fmarketplace.visualstudio.com\u002Fitems?itemName=typespec.typespec-vscode) or directly on the command line:\n\n```\ntsp code install\n```\n\nThe [TypeSpec VS Extension](https:\u002F\u002Fmarketplace.visualstudio.com\u002Fitems?itemName=typespec.typespecvs) can be installed from the [VS Marketplace](https:\u002F\u002Fmarketplace.visualstudio.com\u002Fitems?itemName=typespec.typespecvs) or directly on the command line:\n\n```\ntsp vs install\n```\n\n## [Usage](https:\u002F\u002Ftypespec.io\u002Fdocs#create-first-typespec-project)\n\n### TypeSpec to OpenAPI 3.0 Example\n\nThis example uses the `@typespec\u002Fhttp`, `@typespec\u002Frest`, and `@typespec\u002Fopenapi3` 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\u002Fhttp\";\nimport \"@typespec\u002Frest\";\nimport \"@typespec\u002Fopenapi3\";\n\nusing Http;\nusing Rest;\n\n\u002F** This is a pet store service. *\u002F\n@service(#{ title: \"Pet Store Service\" })\n@server(\"https:\u002F\u002Fexample.com\", \"The service endpoint\")\nnamespace PetStore;\n\n@route(\"\u002Fpets\")\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\u002Fopenapi3\n```\n\nYou can find the emitted OpenAPI output in `.\u002Ftsp-output\u002Fopenapi.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\u002F\u002F Stable setup\n\"dependencies\": {\n  \"@typespec\u002Fcompiler\": \"~0.30.0\",\n  \"@typespec\u002Fhttp\": \"~0.14.0\",\n  \"@typespec\u002Frest\": \"~0.14.0\",\n  \"@typespec\u002Fopenapi\": \"~0.9.0\",\n}\n\n\u002F\u002F Consume next version\n\u002F\u002F In this example: compiler and openapi have changes but rest library has none\n\"dependencies\": {\n  \"@typespec\u002Fcompiler\": \"~0.31.0-dev.5\",\n  \"@typespec\u002Fhttp\": \"~0.14.0\",\n  \"@typespec\u002Frest\": \"~0.14.0\", \u002F\u002F No changes to @typespec\u002Frest library so need to stay the latest.\n  \"@typespec\u002Fopenapi\": \"~0.10.0-dev.2\",\n}\n```\n\n## Packages\n\n| Name                                               | Changelog                        | Latest                                                                                                                                   | Next                                                                      |\n| -------------------------------------------------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |\n| Core functionality                                 |                                  |                                                                                                                                          |                                                                           |\n| [@typespec\u002Fcompiler][compiler_src]                 | [Changelog][compiler_chg]        | [![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@typespec\u002Fcompiler)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@typespec\u002Fcompiler)                                 | ![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@typespec\u002Fcompiler\u002Fnext)                 |\n| TypeSpec Libraries                                 |                                  |                                                                                                                                          |                                                                           |\n| [@typespec\u002Fhttp][http_src]                         | [Changelog][http_chg]            | [![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@typespec\u002Fhttp)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@typespec\u002Fhttp)                                         | ![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@typespec\u002Fhttp\u002Fnext)                     |\n| [@typespec\u002Frest][rest_src]                         | [Changelog][rest_chg]            | [![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@typespec\u002Frest)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@typespec\u002Frest)                                         | ![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@typespec\u002Frest\u002Fnext)                     |\n| [@typespec\u002Fopenapi][openapi_src]                   | [Changelog][openapi_chg]         | [![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@typespec\u002Fopenapi)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@typespec\u002Fopenapi)                                   | ![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@typespec\u002Fopenapi\u002Fnext)                  |\n| [@typespec\u002Fopenapi3][openapi3_src]                 | [Changelog][openapi3_chg]        | [![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@typespec\u002Fopenapi3)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@typespec\u002Fopenapi3)                                 | ![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@typespec\u002Fopenapi3\u002Fnext)                 |\n| [@typespec\u002Fversioning][versioning_src]             | [Changelog][versioning_chg]      | [![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@typespec\u002Fversioning)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@typespec\u002Fversioning)                             | ![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@typespec\u002Fversioning\u002Fnext)               |\n| TypeSpec Tools                                     |                                  |                                                                                                                                          |                                                                           |\n| [@typespec\u002Fprettier-plugin-typespec][prettier_src] | [Changelog][prettier_chg]        | [![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@typespec\u002Fprettier-plugin-typespec)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@typespec\u002Fprettier-plugin-typespec) | ![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@typespec\u002Fprettier-plugin-typespec\u002Fnext) |\n| [typespec-vs][typespec-vs_src]                     | [Changelog][typespec-vs_chg]     | [![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Ftypespec-vs)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Ftypespec-vs)                                               | ![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Ftypespec-vs\u002Fnext)                        |\n| [typespec-vscode][typespec-vscode_src]             | [Changelog][typespec-vscode_chg] | [![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Ftypespec-vscode)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Ftypespec-vscode)                                       | ![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Ftypespec-vscode\u002Fnext)                    |\n| [tmlanguage-generator][tmlanguage_src]             | [Changelog][tmlanguage_chg]      | [![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Ftmlanguage-generator)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Ftmlanguage-generator)                             | ![](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Ftmlanguage-generator\u002Fnext)               |\n\n[compiler_src]: packages\u002Fcompiler\n[compiler_chg]: packages\u002Fcompiler\u002FCHANGELOG.md\n[http_src]: packages\u002Fhttp\n[http_chg]: packages\u002Fhttp\u002FCHANGELOG.md\n[rest_src]: packages\u002Frest\n[rest_chg]: packages\u002Frest\u002FCHANGELOG.md\n[openapi_src]: packages\u002Fopenapi\n[openapi_chg]: packages\u002Fopenapi\u002FCHANGELOG.md\n[openapi3_src]: packages\u002Fopenapi3\n[openapi3_chg]: packages\u002Fopenapi3\u002FCHANGELOG.md\n[versioning_src]: packages\u002Fversioning\n[versioning_chg]: packages\u002Fversioning\u002FCHANGELOG.md\n[prettier_src]: packages\u002Fprettier-plugin-typespec\n[prettier_chg]: packages\u002Fprettier-plugin-typespec\u002FCHANGELOG.md\n[typespec-vs_src]: packages\u002Ftypespec-vs\n[typespec-vs_chg]: packages\u002Ftypespec-vs\u002FCHANGELOG.md\n[typespec-vscode_src]: packages\u002Ftypespec-vscode\n[typespec-vscode_chg]: packages\u002Ftypespec-vscode\u002FCHANGELOG.md\n[tmlanguage_src]: packages\u002Ftmlanguage-generator\n[tmlanguage_chg]: packages\u002Ftmlanguage-generator\u002FCHANGELOG.md\n\n`@next` version of the package are the latest versions available on the `main` branch.\n","TypeSpec 是一种用于定义云服务API和数据结构的语言。它具有高度可扩展性，能够描述REST、OpenAPI、gRPC等协议中常见的API模式，并支持生成多种API描述格式、客户端和服务端代码以及文档，确保TypeSpec定义作为单一真实源。该语言允许创建可复用的API设计模式并打包成库，为API设计师提供规范指导，同时通过丰富的语法检查框架识别不良实践。TypeSpec适用于需要统一管理API定义及其衍生资产的场景，如微服务架构下的API开发与维护。",2,"2026-06-11 03:37:43","high_star"]