Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated

* text=auto eol=lf
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy-doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ jobs:
uses: actions/setup-node@v6
with:
node-version: 22
- name: Enable Corepack
run: corepack enable
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
working-directory: docs
run: yarn install --immutable
run: bun install --frozen-lockfile
- name: Deploy
working-directory: docs
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: yarn deploy
run: bun run deploy
28 changes: 9 additions & 19 deletions .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,27 @@ jobs:
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
# disable setup-node@v5's caching to be able to setup yarn
# https://github.com/actions/setup-node/issues/1357
package-manager-cache: false
- name: Enable corepack
run: corepack enable
# until setup-node have better support for corepack we have to setup yarn in 2 steps
# https://github.com/actions/setup-node/issues/531
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
# yarn is now installed so we can enable caching
cache: 'yarn'
- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: yarn install --immutable
run: bun install --frozen-lockfile

- name: Check formatting
run: yarn format:check
run: bun run format:check

- name: Build packages
run: yarn build
run: bun run build

- name: Lint packages
run: yarn lint
run: bun run lint

- name: Test packages
run: yarn test
run: bun run test

- name: Verify snapshot
# this step also runs the generate-api task
run: yarn test:snapshots
run: bun run test:snapshots

- name: Verify generated code can build
run: yarn workspace orval-tests build
run: bun run --filter orval-tests build
21 changes: 7 additions & 14 deletions .github/workflows/release-prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,11 @@ jobs:
uses: actions/setup-node@v6
with:
node-version: 24

- name: Enable Corepack
run: corepack enable

- name: Cache Yarn dependencies
uses: actions/cache@v5
with:
path: .yarn/cache
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: yarn install --immutable
run: bun install --frozen-lockfile

# 🔧 New step to remove stableVersion recursively
- name: Remove all stableVersion fields
Expand All @@ -56,8 +47,10 @@ jobs:
- name: Update versions, generated output and snapshots
run: |
echo "Updating all workspace versions to ${{ github.event.inputs.version }}"
yarn workspaces foreach -Av version "${{ github.event.inputs.version }}"
yarn test:snapshots:update
for pkg in packages/*/package.json package.json; do
jq --arg v "${{ github.event.inputs.version }}" '.version = $v' "$pkg" > tmp.$$.json && mv tmp.$$.json "$pkg"
done
bun run test:snapshots:update
Comment on lines +50 to +53
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check workspace configuration
echo "=== Workspaces defined in root package.json ==="
jq -r '.workspaces[]?' package.json 2>/dev/null || echo "No workspaces field found"

echo ""
echo "=== All package.json files in repository ==="
fd -g 'package.json' --type f | sort

Repository: orval-labs/orval

Length of output: 1783


Verify version bump coverage for all intended workspaces.

The loop only covers packages/*/package.json and the root, but the workspace configuration defines three globs: packages/*, samples/**, and tests. This misses:

  • Nested workspaces under samples/ (e.g., samples/hono/hono-with-fetch-client/hono-app/package.json)
  • The tests/package.json workspace

Use find . -name package.json -not -path '*/node_modules/*' to ensure all workspaces are version-bumped, or derive the list from the workspaces field in package.json.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-prepare.yaml around lines 50 - 53, The current
for-loop that updates versions (the block iterating over packages/*/package.json
and package.json and using jq to write tmp.$$.json then mv) misses nested
workspaces (samples/**) and tests; update the loop to enumerate all package.json
files for workspaces (e.g., use find . -name package.json -not -path
'*/node_modules/*' or parse the root package.json "workspaces" field) so every
workspace package.json is updated with jq --arg v ... '.version = $v' and moved
via tmp.$$.json before running bun run test:snapshots:update; ensure the new
iteration still excludes node_modules and preserves the existing jq/temp-file
pattern.


- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
Expand Down
30 changes: 14 additions & 16 deletions .github/workflows/release-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,18 @@ jobs:
uses: actions/setup-node@v6
with:
node-version: 24

- name: Enable Corepack
run: corepack enable

- name: Cache Yarn dependencies
uses: actions/cache@v5
with:
path: .yarn/cache
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: yarn install --immutable
run: bun install --frozen-lockfile

- name: Run build
run: yarn build
run: bun run build

- name: Configure npm authentication
run: |
yarn config set npmRegistryServer "https://registry.npmjs.org"
yarn config set npmAuthToken ${{ secrets.NPM_TOKEN }}
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc

- name: Fail if unsafe lifecycle scripts exist
run: |
Expand All @@ -61,7 +51,15 @@ jobs:
echo "No unsafe lifecycle scripts detected."

- name: Publish workspaces to npm
run: yarn workspaces foreach --all --no-private -v npm publish --access public --tolerate-republish
run: |
for pkg in packages/*/package.json; do
dir=$(dirname "$pkg")
if ! jq -e '.private' "$pkg" > /dev/null 2>&1 || [ "$(jq -r '.private' "$pkg")" = "false" ] || [ "$(jq -r '.private' "$pkg")" = "null" ]; then
echo "Publishing $(jq -r '.name' "$pkg")..."
cd "$dir" && npm publish --access public || true
cd -
Comment on lines +54 to +60
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -name "release-publish.yaml" -o -name "release-publish.yml" | head -20

Repository: orval-labs/orval

Length of output: 100


🏁 Script executed:

cat -n .github/workflows/release-publish.yaml | head -80

Repository: orval-labs/orval

Length of output: 3252


🏁 Script executed:

# Verify there are no other error handlers or conditions after the publish step
cat -n .github/workflows/release-publish.yaml | sed -n '53,80p'

Repository: orval-labs/orval

Length of output: 1309


🏁 Script executed:

# Check if there are any on-error handlers or continue-on-error flags
grep -n "continue-on-error\|if:\|on-error" .github/workflows/release-publish.yaml

Repository: orval-labs/orval

Length of output: 174


Don't swallow publish failures.
npm publish ... || true suppresses errors and allows the workflow to succeed even when a package fails to publish. Since subsequent steps create GitHub tags and releases unconditionally (lines 70-80), this can result in a tagged release with missing npm packages. Track failures across the loop and fail the job if any publish attempt fails.

🔧 Suggested fix
       - name: Publish workspaces to npm
         run: |
+          failed=0
           for pkg in packages/*/package.json; do
             dir=$(dirname "$pkg")
             if ! jq -e '.private' "$pkg" > /dev/null 2>&1 || [ "$(jq -r '.private' "$pkg")" = "false" ] || [ "$(jq -r '.private' "$pkg")" = "null" ]; then
               echo "Publishing $(jq -r '.name' "$pkg")..."
-              cd "$dir" && npm publish --access public || true
-              cd -
+              if ! (cd "$dir" && npm publish --access public); then
+                echo "Publish failed for $(jq -r '.name' "$pkg")"
+                failed=1
+              fi
             fi
           done
+          exit $failed
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-publish.yaml around lines 54 - 60, The workflow
currently swallows publish errors via "npm publish ... || true"; update the loop
that iterates over pkg (packages/*/package.json) to track failures instead:
remove the "|| true", capture the exit code of npm publish for each package
(using the pkg/dir variables), set a flag variable (e.g., publish_failed=1) if
any publish fails, and after the loop check that flag and exit non‑zero to fail
the job so later tag/release steps only run on success.

fi
done

- name: Extract version
id: version
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.yarn

# Runtime data
pids
Expand Down Expand Up @@ -84,9 +83,6 @@ typings/
# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env*

Expand Down
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
yarn commitlint --edit
bun run commitlint --edit
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
yarn format:staged
bun run format:staged
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Restore Husky shim/shebang to keep hooks reliable.
Without the standard Husky header, the hook can fail to execute in some environments.

🔧 Suggested fix
+#!/usr/bin/env sh
+. "$(dirname -- "$0")/_/husky.sh"
+
 bun run format:staged
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
bun run format:staged
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
bun run format:staged
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.husky/pre-commit at line 1, The hook currently only contains the command
"bun run format:staged" and is missing the Husky shim/shebang header; update the
.husky/pre-commit hook to include a POSIX shebang and source the Husky
shim/initializer at the top of the file before the existing bun run
format:staged command so the hook runs reliably across environments (i.e., add
the standard "#!/usr/bin/env sh" shebang and the line that sources the
repository's husky.sh before invoking bun run format:staged).

2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ node_modules
**/dist
.husky
mockServiceWorker.js
yarn.lock
bun.lockb
.svelte-kit
.prettierignore

Expand Down
4 changes: 2 additions & 2 deletions .release-it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default {
},
},
hooks: {
'before:init': ['yarn run build', 'yarn run test:ci'],
'after:bump': ['yarn run build --force', 'yarn run update-samples'],
'before:init': ['bun run build', 'bun run test:ci'],
'after:bump': ['bun run build --force', 'bun run update-samples'],
},
} satisfies Config;
Binary file added .yarn/install-state.gz
Binary file not shown.
70 changes: 0 additions & 70 deletions .yarnrc.yml

This file was deleted.

4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ then, clone it to your local machine:
gh repo clone <your-github-name>/orval
```

Install dependencies and set up Git hooks. Because `enableScripts` is disabled in `.yarnrc.yml`, lifecycle scripts won't run automatically, so run the following manually after cloning:
Install dependencies and set up Git hooks:

```bash
yarn install && yarn prepare
bun install && bun run prepare
```

### Implement your changes
Expand Down
6 changes: 3 additions & 3 deletions DEBUGGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ There are several methods available for debugging the Orval codebase.

## Running the Development Environment

The first step when working with the project is to set up the development environment. After following the setup instructions in the [CONTRIBUTING.md](./CONTRIBUTING.md) file, you can use the default command `yarn dev` to run the codebase locally. This command is part of the `turbo dev` process and will run the sample project located at [react-query/basic](./samples/react-query/basic/). You can use this sample as a starting point to debug the output generated by the project.
The first step when working with the project is to set up the development environment. After following the setup instructions in the [CONTRIBUTING.md](./CONTRIBUTING.md) file, you can use the default command `bun run dev` to run the codebase locally. This command is part of the `turbo dev` process and will run the sample project located at [react-query/basic](./samples/react-query/basic/). You can use this sample as a starting point to debug the output generated by the project.

If you'd like to try debugging a different sample, feel free to update the `generate-api` script in the [package.json](./packages/orval/package.json) file to reference a different sample or modify the existing `react-query/basic` sample as needed.

Expand All @@ -17,7 +17,7 @@ Below is an example configuration for Visual Studio Code that you can add to you
"type": "node",
"request": "launch",
"name": "Run Dev Server",
"runtimeExecutable": "yarn",
"runtimeExecutable": "bun",
"args": ["dev"],
"skipFiles": ["<node_internals>/**"],
"console": "integratedTerminal",
Expand Down Expand Up @@ -49,7 +49,7 @@ To run these tests in your IDE, you can use the following configuration in Visua
"type": "node",
"request": "launch",
"name": "Debug Current Test File",
"runtimeExecutable": "yarn",
"runtimeExecutable": "bun",
"args": [
"test",
"${file}" // Refers to the currently open file in the editor
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,43 +58,43 @@ Try Orval out for yourself using our [Playground](https://orval.dev/playground)

## Developers

This project uses [Yarn](https://yarnpkg.com/) for package management and building. Yarn [install guide](https://yarnpkg.com/getting-started/install).
This project uses [Bun](https://bun.sh/) for package management and building. Bun [install guide](https://bun.sh/docs/installation).

### Build Scripts

- **`yarn nuke:all`** - Completely clean your workspace by removing all build artifacts, node_modules, and cached files. Use this when you want to start fresh.
- **`bun run nuke:all`** - Completely clean your workspace by removing all build artifacts, node_modules, and cached files. Use this when you want to start fresh.

- **`yarn build`** - Build the project and make changes available to the workspace. Run this after making code changes to compile TypeScript and prepare the project for use.
- **`bun run build`** - Build the project and make changes available to the workspace. Run this after making code changes to compile TypeScript and prepare the project for use.

### Test Scripts

- **`yarn test`** - Run unit tests in all packages.
- **`bun run test`** - Run unit tests in all packages.

- **`yarn update-samples`** - Generate sample outputs using the newly built version of Orval. This regenerates the sample code based on the current build.
- **`bun run update-samples`** - Generate sample outputs using the newly built version of Orval. This regenerates the sample code based on the current build.

- **`yarn test:samples`** - Run tests in the samples directory using the newly generated output from `update-samples`.
- **`bun run test:samples`** - Run tests in the samples directory using the newly generated output from `update-samples`.

- **`yarn test:snapshots`** - Run snapshot tests to verify generated sample outputs match the committed snapshots. Fails if any generated file differs from its snapshot.
- **`bun run test:snapshots`** - Run snapshot tests to verify generated sample outputs match the committed snapshots. Fails if any generated file differs from its snapshot.

- **`yarn test:snapshots:update`** - Regenerate snapshot files to match the current generated output. Run this after `yarn update-samples` when the generated output has intentionally changed.
- **`bun run test:snapshots:update`** - Regenerate snapshot files to match the current generated output. Run this after `bun run update-samples` when the generated output has intentionally changed.

- **`yarn test:cli`** - Test that the generated output (not samples) is valid TypeScript. This validates the TypeScript compilation of the generated code.
- **`bun run test:cli`** - Test that the generated output (not samples) is valid TypeScript. This validates the TypeScript compilation of the generated code.

### Development Workflow

A typical development workflow would be:

1. Make your code changes
2. Run `yarn build` to compile your changes
3. Run `yarn lint` to catch lint issues early
4. Run `yarn test` to run unit tests in packages
5. Run `yarn test:snapshots` to verify generated output matches snapshots
2. Run `bun run build` to compile your changes
3. Run `bun run lint` to catch lint issues early
4. Run `bun run test` to run unit tests in packages
5. Run `bun run test:snapshots` to verify generated output matches snapshots

If step 5 fails because the generated output has intentionally changed, run `yarn test:snapshots:update` to update the snapshots.
If step 5 fails because the generated output has intentionally changed, run `bun run test:snapshots:update` to update the snapshots.

If you encounter issues or want to start completely fresh:

1. Run `yarn nuke:all` to clean everything
1. Run `bun run nuke:all` to clean everything
2. Reinstall dependencies and rebuild from scratch

## Sponsors
Expand Down
Loading