Skip to content

Conversation

@soartec-lab
Copy link
Member

@soartec-lab soartec-lab commented Dec 21, 2025

fix #2598

Summary

⚠️ BREAKING CHANGE: Unified Zod schema naming convention to PascalCase

Changed all Zod schema exports to PascalCase to align with TypeScript type definition naming conventions.

Purpose

Orval is currently being improved to output both Zod schemas and TypeScript type definitions. By including both in a single .zod.ts file, schemas and types can be handled with the same name.

// createPetsBody.zod.ts
export const CreatePetsBody = zod.object({
  name: zod.string(),
  tag: zod.string()
})

export type CreatePetsBody = zod.infer<typeof CreatePetsBody>
import { CreatePetsBody } from './createPetsBody.zod'

// Use as type
const body: CreatePetsBody = { name: 'Fluffy', tag: 'cat' }

// Use as schema (runtime validation)
CreatePetsBody.parse(body)

Since TypeScript type definitions use PascalCase as standard, Zod schemas need to follow the same naming convention. This allows schemas and types to be handled with the same name, improving developer experience.

Changes

- export const createPetsBody = zod.object({
+ export const CreatePetsBody = zod.object({
    name: zod.string(),
    tag: zod.string()
  })

- export type CreatePetsBody = zod.infer<typeof createPetsBody>
+ export type CreatePetsBody = zod.infer<typeof CreatePetsBody>

Migration Guide

If your existing code imports Zod schemas, change the import names to PascalCase:

- import { createPetsBody } from './api'
+ import { CreatePetsBody } from './api'

@soartec-lab soartec-lab added enhancement New feature or request zod Zod related issue hono Hono related issue fetch Fetch client related issue mcp breaking change Breaking change on upgrade labels Dec 21, 2025
@soartec-lab soartec-lab changed the title feat(zod,hono,mcp): changed naming convention of zod schema name to pascal-case feat(fetch,zod,hono,mcp): changed naming convention of zod schema name to pascal-case Dec 21, 2025
@soartec-lab soartec-lab added this to the 8.0.0 milestone Dec 21, 2025
@soartec-lab soartec-lab force-pushed the feat/change-zod-schema-to-pascal-case branch from 64c947f to 87758e0 Compare December 21, 2025 04:59
@soartec-lab soartec-lab marked this pull request as ready for review December 21, 2025 05:59
Copilot AI review requested due to automatic review settings December 21, 2025 05:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a breaking change that standardizes Zod schema naming to PascalCase, aligning with TypeScript type definition conventions. This change enables better integration with tools like Orval that generate both schemas and type definitions in the same file.

Key Changes:

  • Modified the Zod schema generation logic to use PascalCase for all exported schema names
  • Updated all sample files to reflect the new naming convention
  • Added migration documentation for users upgrading to v8

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/zod/src/index.ts Core implementation change converting schema names from camelCase to PascalCase
packages/mcp/src/index.ts Updated MCP package to use PascalCase for schema references
packages/hono/src/index.ts Updated Hono package to use PascalCase for schema references
packages/zod/src/zod.test.ts Updated test expectations to match new PascalCase naming
samples/swr-with-zod/src/gen/endpoints/pets/pets.zod.ts Updated generated sample file with PascalCase exports
samples/mcp/petstore/src/tool-schemas.zod.ts Updated MCP sample schemas to PascalCase
samples/mcp/petstore/src/server.ts Updated imports to use PascalCase schema names
samples/mcp/petstore/orval.config.js New configuration file for the MCP sample
samples/hono/hono-with-zod/src/petstore.zod.ts Updated Hono with Zod sample to PascalCase
samples/hono/hono-with-fetch-client/hono-app/src/petstore.zod.ts Updated Hono with fetch client sample to PascalCase
samples/hono/composite-routes-with-tags-split/src/endpoints/pets/pets.zod.ts Updated composite routes sample schemas to PascalCase
samples/hono/composite-routes-with-tags-split/src/endpoints/pets/pets.handlers.ts Updated handlers to import and use PascalCase schemas
docs/src/pages/guides/migration-v8.mdx Added migration guide for the naming convention change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@melloware melloware merged commit f9a4bb0 into orval-labs:master Dec 21, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Breaking change on upgrade enhancement New feature or request fetch Fetch client related issue hono Hono related issue mcp zod Zod related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

proposal: enhanced zod Integration for fetch Client

2 participants