Skip to content

fix: vite plugin loads default openapi-ts config file when no explicit config is provided#3793

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-vite-plugin-openapi-ts-config
Draft

fix: vite plugin loads default openapi-ts config file when no explicit config is provided#3793
Copilot wants to merge 3 commits intomainfrom
copilot/fix-vite-plugin-openapi-ts-config

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 19, 2026

When heyApiPlugin() is used in vite.config.js without a config option, no client generation occurs even if an openapi-ts.config.ts file exists in the project root.

Root cause

createClient(undefined) resolves to userConfigs = [] in generate.ts. Since resolveJobs in init.ts only calls loadConfigFile per entry in userConfigs, an empty array means the default config file is never discovered.

Fix

In resolveJobs (packages/openapi-ts/src/config/init.ts):

  • When userConfigs is empty (implicit call with no config), fall back to a single empty config {} to trigger the default openapi-ts.config.ts lookup via c12
  • Only push loaded configs when foundConfig === true or the user explicitly provided configs — prevents spurious "missing input/output" validation errors on implicit no-op calls while preserving existing CLI validation behavior
// vite.config.js — this now correctly picks up openapi-ts.config.ts
export default defineConfig({
  plugins: [vue(), heyApiPlugin()],
});

Behavior matrix

Scenario Before After
Vite plugin, no config, openapi-ts.config.ts present silent no-op config file loaded ✓
Vite plugin, no config, no config file silent no-op silent no-op ✓
CLI, no args, no config file validation error validation error ✓
CLI, with args works works ✓

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node /home/REDACTED/work/openapi-ts/openapi-ts/node_modules/.pnpm/next@15.2.4_react-dom@19.0.0_react@19.0.0__react@19.0.0_sass@1.97.3/node_modules/next/dist/compiled/jest-worker/processChild.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 19, 2026

⚠️ No Changeset found

Latest commit: ec9348c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hey-api-docs Ready Ready Preview, Comment Apr 19, 2026 11:21pm

Request Review

@pullfrog
Copy link
Copy Markdown
Contributor

pullfrog Bot commented Apr 19, 2026

TL;DR — This is an empty WIP draft PR opened to fix #3792, where the Vite plugin ignores the default openapi-ts.config.ts config file when no inline config is passed to heyApiPlugin(). No code changes have been pushed yet.

Key changes

  • (No changes yet — PR branch is identical to main)

Summary | 0 files | 0 commits | base: maincopilot/fix-vite-plugin-openapi-ts-config

Pullfrog  | View workflow run | via Pullfrog𝕏

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

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

This is an empty WIP draft PR — it contains a single "Initial plan" commit with zero file changes. There's nothing to review yet. Will re-review once implementation commits are pushed.

Task list (3/3 completed)
  • Checkout PR and read diff
  • Investigate PR changes and Vite plugin code
  • Submit review

Pullfrog  | Fix it ➔View workflow run𝕏

Copilot AI changed the title [WIP] Fix Vite plugin not using default openapi-ts config file fix: vite plugin loads default openapi-ts config file when no explicit config is provided Apr 19, 2026
Copilot AI requested a review from mrlubos April 19, 2026 23:20
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.80%. Comparing base (3cc893d) to head (ec9348c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3793   +/-   ##
=======================================
  Coverage   39.80%   39.80%           
=======================================
  Files         530      530           
  Lines       19467    19470    +3     
  Branches     5791     5793    +2     
=======================================
+ Hits         7748     7751    +3     
  Misses       9487     9487           
  Partials     2232     2232           
Flag Coverage Δ
unittests 39.80% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vite plugin is not using default openapi-ts config file

2 participants