Skip to main content
Glama
zod-schemas.md2.06 kB
# Automatically Generated Zod Schemas This project now uses automatically generated Zod schemas from the Shortcut OpenAPI specification. ## How it Works 1. **OpenAPI Spec**: Downloaded from Shortcut's official API 2. **Generation**: Using `openapi-zod-client` to generate Zod schemas 3. **Type Safety**: Schemas match the TypeScript types exactly ## Generating/Updating Schemas To update both TypeScript types and Zod schemas when the API changes: ```bash # Generate everything (types + Zod schemas) pnpm run generate:all # Or individually: pnpm run generate:types # TypeScript types only pnpm run generate:zod # Zod schemas only ``` ## Using the Schemas ```typescript import { StorySchema, UpdateStorySchema, CreateStoryCommentSchema } from './generated-schemas' // Validate API responses const validatedStory = StorySchema.parse(apiResponse) // Validate input data const validatedUpdate = UpdateStorySchema.parse({ description: "New description", labels: [{ name: "urgent" }] }) ``` ## Available Schemas All Shortcut API schemas are available, including: - `StorySchema` - Full story object - `UpdateStorySchema` - Story update parameters - `CreateStoryCommentSchema` - Comment creation parameters - `WorkflowSchema` - Workflow with states - `ProjectSchema` - Project details - `EpicSchema` - Epic details - `MemberSchema` - Member/user details - And many more... ## Benefits 1. **Always Synchronized**: Types and schemas are generated from the same source 2. **Runtime Validation**: Catch API changes and invalid data at runtime 3. **Better Error Messages**: Zod provides detailed validation errors 4. **No Manual Maintenance**: Schemas update automatically with API changes ## Advanced Usage For access to all generated schemas: ```typescript import { allSchemas } from './generated-schemas' // Access any schema const customSchema = allSchemas.CustomFieldValue ``` The generated Zodios API client is also available for type-safe API calls: ```typescript import { generatedApi } from './generated-schemas' ```

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