Hey API Codegen by blockmatic/basilic
npx skills add https://github.com/blockmatic/basilic --skill 'Hey API Codegen'@hey-api/openapi-ts 从 OpenAPI 3.0 规范生成 TypeScript 客户端@hey-api/openapi-ts v0+createClient 工厂函数来实例化客户端openapi-ts.config.ts 进行配置广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
response.error 以获取类型化的错误响应schemas.type: 'zod')进行运行时验证output.format: 'prettier')types.enums: 'typescript')// openapi-ts.config.ts
import { defineConfig } from '@hey-api/openapi-ts'
export default defineConfig({
input: './openapi.json',
output: {
path: './src/gen',
format: 'prettier',
},
types: {
enums: 'typescript',
},
schemas: {
type: 'zod',
},
})
import { createClient } from './gen/client'
const client = createClient({
baseUrl: 'https://api.example.com',
})
const response = await client.GET('/users/{id}', {
params: { path: { id: '123' } },
})
if (response.error) {
// 处理类型化的错误
return
}
// response.data 根据 OpenAPI 规范进行了类型化
完整示例请参见 配置模板。
每周安装量
0
代码仓库
GitHub 星标数
89
首次出现
1970年1月1日
安全审计
@hey-api/openapi-ts@hey-api/openapi-ts v0+createClient factory for client instantiationopenapi-ts.config.ts for configurationresponse.error for typed error responsesschemas.type: 'zod') for runtime validationoutput.format: 'prettier')types.enums: 'typescript')// openapi-ts.config.ts
import { defineConfig } from '@hey-api/openapi-ts'
export default defineConfig({
input: './openapi.json',
output: {
path: './src/gen',
format: 'prettier',
},
types: {
enums: 'typescript',
},
schemas: {
type: 'zod',
},
})
import { createClient } from './gen/client'
const client = createClient({
baseUrl: 'https://api.example.com',
})
const response = await client.GET('/users/{id}', {
params: { path: { id: '123' } },
})
if (response.error) {
// Handle typed error
return
}
// response.data is typed from OpenAPI spec
See Config Template for complete example.
Weekly Installs
0
Repository
GitHub Stars
89
First Seen
Jan 1, 1970
Security Audits
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
29,800 周安装
Docnify自动化:通过Rube MCP和Composio工具包实现文档操作自动化
1 周安装
Docmosis自动化集成指南:通过Rube MCP与Composio实现文档生成自动化
1 周安装
Dictionary API自动化教程:通过Rube MCP和Composio实现词典API操作自动化
1 周安装
detrack-automation:自动化追踪技能,集成Claude AI提升开发效率
1 周安装
Demio自动化工具包:通过Rube MCP和Composio实现Demio操作自动化
1 周安装
Deel自动化工具:通过Rube MCP与Composio实现HR与薪资操作自动化
1 周安装