Upgrading to v8

Upgrading to v8

v8 was developed with over 150 commits during the development period (v8.0.0-rc.0 to rc.5).

Overview

v8 brings significant improvements focused on modern JavaScript ecosystem support and enhanced Zod schema integration.


New Features

🚀 Full Migration to ESM (ECMAScript Modules)

The entire project has been migrated from CommonJS to ESM.

Key Changes:

  • All packages now use "type": "module" in package.json
  • Import/export syntax instead of require()
  • Node.js 22.18 or higher is required

Updating configuration files:

# Rename to .mjs extension
mv orval.config.js orval.config.mjs
# Or add to package.json
# "type": "module"

If importing Orval programmatically:

- const { generate } = require('orval');
+ import { generate } from 'orval';

If using dynamic imports:

- const config = require('./orval.config.js');
+ const config = await import('./orval.config.js');

Note: .ts files require no changes if written in ESM style.

Benefits of ESM:

  • Better tree-shaking (unused code elimination)
  • Native browser support
  • Async module loading
  • Aligns with JavaScript ecosystem standards
  • Stricter module boundaries (better encapsulation and type safety)

🌐 Default HTTP Client Changed

The default HTTP client has been changed from axios to fetch.

Reasons:

  • Reduced bundle size
  • No additional dependencies required

To continue using axios:

export default {
petstore: {
output: {
httpClient: 'axios', // Explicitly specify
target: './src/api',
},
input: {
target: './petstore.yaml',
},
},
};

🔷 New Framework Support

Angular Query

TanStack Query for Angular is now supported.

export default {
petstore: {
output: {
client: 'angular-query',
target: './src/api',
},
input: {
target: './petstore.yaml',
},
},
};

Solid Query / SolidStart

Support for the SolidJS ecosystem has been added.

export default {
petstore: {
output: {
client: 'solid-query',
target: './src/api',
},
input: {
target: './petstore.yaml',
},
},
};

🛡️ Enhanced Zod Schema Integration

Schema Type Selection

You can now select Zod schemas using output.schemas.type.

export default {
petstore: {
output: {
schemas: {
path: './model',
type: 'zod', // 'typescript' | 'zod'
},
},
},
};

Generated files:

  • type: 'typescript'./model/pet.ts
  • type: 'zod'./model/pet.zod.ts

Runtime Validation

Runtime validation is now available for the Fetch client.

export default {
petstore: {
output: {
schemas: {
type: 'zod',
},
client: 'fetch',
override: {
fetch: {
runtimeValidation: true,
},
},
},
},
};

Generated code:

import { PetsSchema } from './model/index.zod';
export const listPets = async (params: ListPetsParams) => {
const res = await fetch(getListPetsUrl(params), { method: 'GET' });
const body = await res.text();
const parsedBody = body ? JSON.parse(body) : {};
const data = PetsSchema.parse(parsedBody); // Runtime validation
return { data, status: res.status, headers: res.headers };
};

Schema Names Changed to PascalCase

Zod schema export names have been unified to PascalCase.

- 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>

⚛️ React Compiler Support

TanStack Query (React Query) has been updated to fix code that was preventing React Compiler optimizations, enabling React Compiler to work correctly.


📦 Combined Types Inlining

anyOf, oneOf, and allOf are now inlined by default.

Before:

export type Response401OneOf = { defined: true; ... };
export type Response401OneOfTwo = { defined: false; ... };
export type Response401 = Response401OneOf | Response401OneOfTwo;

After:

export type Response401 = { defined: true; ... } | { defined: false; ... };

To maintain previous behavior:

export default {
petstore: {
output: {
override: {
aliasCombinedTypes: true,
},
},
},
};

Breaking Changes

1. Converted to ESM (ECMAScript Modules)

The project has been fully converted from CommonJS to ESM. This modernizes the codebase and aligns with the JavaScript ecosystem's direction.

Key Changes

  • All packages now use "type": "module" in package.json
  • Import/export syntax instead of require()
  • Node.js 22.18 or higher is required
  • Configuration files should use .mjs extension or set "type": "module"
    • however, .ts is still the preferred format and requires no changes if written in ESM style

How to migrate

Update Node.js version

Ensure you're using Node.js 22.18 or higher:

node --version # Should be >= 22.18.0
Update configuration files

If you're using a JavaScript configuration file, either:

  1. Rename it to use .mjs extension:
mv orval.config.js orval.config.mjs
  1. Or add "type": "module" to your package.json:
{
"name": "your-project",
+ "type": "module",
...
}
Update imports in your code

If you were importing Orval programmatically:

- const { generate } = require('orval');
+ import { generate } from 'orval';
Update dynamic imports

If you were using dynamic imports:

- const config = require('./orval.config.js');
+ const config = await import('./orval.config.js');

Benefits of ESM

  • Better tree-shaking: Unused code is more easily eliminated
  • Native browser support: ESM works directly in modern browsers
  • Async module loading: Improved performance with lazy loading
  • Future-proof: Aligns with JavaScript ecosystem standards
  • Stricter module boundaries: Better encapsulation and type safety

2. Changed default value of httpClient from axios to fetch

We changed the default httpClient from axios to fetch to reduce bundle size and eliminate the need for additional dependencies.

How to maintain compatibility

If you want to keep using axios, configure it as follows:

export default {
petstore: {
output: {
+ httpClient: 'axios', // Explicitly specify
target: './src/api',
},
input: {
target: './petstore.yaml',
},
},
};

3. Removed override.fetch.explode option

This parameter was kept only for compatibility. Since compatibility maintenance is no longer needed in major versions, it has been removed.

How to maintain compatibility

Specify explode directly in the OpenAPI specification file.

paths:
/pets:
get:
parameters:
- name: tags
in: query
+ explode: true
schema:
type: array

4. Changed default value of override.mock.delay from 1000 to false

We disabled the default delay as it creates noise.

How to maintain compatibility

If you want to explicitly set a delay, specify it in milliseconds.

export default {
petstore: {
output: {
mock: {
+ delay: 1000, // In milliseconds
},
},
},
};

5. Removed override.coerceTypes

This was removed as it has been replaced by the more flexible and explicit override.zod.coerce.

How to maintain compatibility

Use override.zod.coerce.

export default {
petstore: {
output: {
override: {
- coerceTypes: true
+ zod: {
+ coerce: {
+ param: true,
+ query: true,
+ header: true,
+ body: true,
+ response: true
+ }
+ }
},
},
},
};

6. Removed override.useNativeEnums

This was removed as it has been integrated into enumGenerationType.

How to maintain compatibility

Use enumGenerationType.

export default {
petstore: {
output: {
override: {
- useNativeEnums: true
+ enumGenerationType: 'enum'
},
},
},
};

7. Changed combined types generation (anyOf/oneOf/allOf)

Combined types (anyOf, oneOf, allOf) are now inlined by default instead of creating intermediate type aliases.

How to maintain compatibility

Use aliasCombinedTypes.

export default {
petstore: {
output: {
override: {
+ aliasCombinedTypes: true,
},
},
},
};

8. Zod Schema Naming Convention Changed to PascalCase

All Zod schema exports now use PascalCase naming convention to align with TypeScript type definition standards.

What Changed

- 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>

Other Improvements

Variable Expansion in Fetch Client Headers

Variable expansion is now supported in override.requestOptions.headers.

Bug Fixes

  • Zod nullable + $ref support (OpenAPI 3.1 compliance)
  • oneOf/anyOf common properties support
  • Date parameter fixes
  • Svelte 5 reactivity support

Release Timeline

VersionRelease DateMain Changes
v8.0.0-rc.02025-10-27ESM migration, basic Breaking Changes
v8.0.0-rc.12025-10-30ESM module import support (jiti)
v8.0.0-rc.22025-11-14Bug fixes
v8.0.0-rc.32025-12-06Bug fixes
v8.0.0-rc.42025-12-14Zod schema features
v8.0.0-rc.52025-12-23Angular Query, Zod fixes

Acknowledgments

We sincerely thank all contributors, followers, and users for your support. Your encouragement drives us to keep improving. 🙏

Looking forward to the continued growth of our community, we have launched a sponsorship program through Open Collective. If you would like to support Orval's ongoing development, please consider becoming a sponsor.

Was this page helpful?