Skip to main content
Glama
generate-zod.ts937 B
#!/usr/bin/env tsx import { generateZodClientFromOpenAPI } from 'openapi-zod-client' import { readFileSync, writeFileSync } from 'fs' import { join } from 'path' const openApiDoc = JSON.parse( readFileSync(join(process.cwd(), 'shortcut-openapi.json'), 'utf-8') ) async function generateZodSchemas() { console.log('Generating Zod schemas from OpenAPI spec...') const zodSchemas = await generateZodClientFromOpenAPI({ openApiDoc, distPath: '', options: { withAlias: true, shouldExportAllSchemas: true, isMainResponseStatus: (status) => status === '200' || status === '201', } }) // Write the generated schemas const outputPath = join(process.cwd(), 'src/generated/zod-schemas.ts') writeFileSync(outputPath, zodSchemas) console.log(`✓ Generated Zod schemas at ${outputPath}`) } generateZodSchemas().catch(console.error)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/currentspace/shortcut_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server