Skip to content

Conversation

@soartec-lab
Copy link
Member

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

fix #2598

Summary

Changed output.schemas.type to accept only single values ('typescript' | 'zod') and removed the useZodSchemaResponse option.

Changes

Configuration

{
  output: {
    schemas: {
-     type: ['typescript', 'zod']
+     type: 'zod'
    },
-   override: {
-     fetch: {
-       useZodSchemaResponse: true
-     }
-   }
  }
}

Generated Code

- import type { Pet } from './model';
- import { PetSchema } from './model/index.zod';
+ import type { Pet } from './model/index.zod';

When type: 'zod' is specified, all types are now imported from .zod.ts files.

@soartec-lab soartec-lab added this to the 8.0.0 milestone Dec 22, 2025
@soartec-lab soartec-lab added enhancement New feature or request fetch Fetch client related issue labels Dec 22, 2025
@soartec-lab soartec-lab marked this pull request as ready for review December 22, 2025 09:35
Copilot AI review requested due to automatic review settings December 22, 2025 09:35
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 simplifies the schema type configuration by making output.schemas.type accept only a single value ('typescript' | 'zod') instead of an array, and removes the override.fetch.useZodSchemaResponse option. When type: 'zod' is specified, all imports now automatically come from .zod.ts files.

Key Changes:

  • Changed output.schemas.type from accepting an array to accepting a single value
  • Removed the override.fetch.useZodSchemaResponse configuration option
  • Simplified import generation logic in the fetch client to automatically use zod schema imports when type: 'zod' is configured

Reviewed changes

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

Show a summary per file
File Description
tests/configs/fetch.config.ts Updated test configurations to use single schema type values and removed useZodSchemaResponse option
tests/configs/default.config.ts Removed test configuration that used multiple schema types
packages/orval/src/write-specs.ts Simplified schema type handling to work with single values instead of arrays
packages/orval/src/utils/options.ts Updated normalization logic to handle single schema type values and removed useZodSchemaResponse option handling
packages/orval/src/client.ts Added output parameter to generatorClient function call
packages/fetch/src/index.ts Refactored import generation to automatically detect and use zod schemas based on output configuration
packages/core/src/types.ts Updated type definitions to reflect single schema type values and removed useZodSchemaResponse from fetch options

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

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

Labels

enhancement New feature or request fetch Fetch client related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

proposal: enhanced zod Integration for fetch Client

2 participants