orval-labs/orval
`clean: true` deletes the entire working directory when `schemas` has no `path`
已關閉
#3,752 建立於 2026年7月22日
bughelp wanted
倉庫指標
- 星標
- (6,272 顆星)
- PR 合併指標
- (平均合併 2天 15小時) (30 天內合併 73 個 PR)
描述
Description
Repro:
mkdir repro && cd repro
echo '{"openapi":"3.0.0","info":{"title":"t","version":"1"},"paths":{}}' > openapi.json
echo "keep me" > important.txt
cat > orval.config.ts <<'EOF'
import { defineConfig } from "orval";
export default defineConfig({
api: {
input: "./openapi.json",
output: {
target: "./src/generated/api.ts",
client: "fetch",
httpClient: "fetch",
schemas: { type: "zod" }, // no path
mode: "single",
clean: true,
override: { fetch: { runtimeValidation: true } },
},
},
});
EOF
npx orval --config ./orval.config.ts
repro/ is now empty and the command errors.
Output client
fetch
Configuration (orval.config)
export default defineConfig({
api: {
input: "./openapi.json",
output: {
target: "./src/generated/api.ts",
client: "fetch",
httpClient: "fetch",
schemas: { type: "zod" }, // no path
mode: "single",
clean: true,
override: { fetch: { runtimeValidation: true } },
},
},
});
Environment
System: OS: macOS 26.5.2 CPU: (18) arm64 Apple M5 Max Memory: 70.76 GB / 128.00 GB Shell: 5.9 - /bin/zsh npmPackages: @tanstack/react-query: ^5.101.4 => 5.101.4 orval: ^8.22.0 => 8.22.0 react: ^19.2.0 => 19.2.8 zod: ^4.4.3 => 4.4.3
Expected behavior
It shouldn't wipe the entire directory
Actual behavior
It wipes the entire directory
OpenAPI document (minimal, if applicable)
openapi: 3.0.3
info:
title: Demo
version: 0.0.0
paths: {}
Additional context
I ran into this because an agent was setting up orval and it would keep deleting the entire directory and it couldn't figure out why, nothing in the output mentions deleting anything. I was lucky it didn't delete anything meaningful but its a real footgun
This is similar to #3538/#3657