Quick Start
Generate your first type-safe API client in seconds
Get started with Orval in just a few minutes.
Without a Configuration File
The simplest way to use Orval is directly from the command line:
orval --input ./petstore.yaml --output ./src/petstore.ts--inputaccepts any YAML or JSON-formatted OpenAPI specification--outputspecifies the target path for the generated files
With a Configuration File
For more control, create a configuration file. Orval will automatically look for orval.config.js, orval.config.ts, or orval.config.mjs in your project root.
orval --config ./orval.config.js
# or simply
orvalExample Configuration
import { defineConfig } from 'orval';
export default defineConfig({
petstore: {
input: './petstore.yaml',
output: './src/petstore.ts',
},
});Generate React Query Hooks
Want to generate React Query hooks instead? Just set the client option:
import { defineConfig } from 'orval';
export default defineConfig({
petstore: {
input: './petstore.yaml',
output: {
target: './src/api/petstore.ts',
schemas: './src/api/model',
client: 'react-query',
},
},
});