Skip to content

Fix runtimeConfigPath resolution to be relative to output directory#3395

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/fix-runtime-config-path-resolution
Draft

Fix runtimeConfigPath resolution to be relative to output directory#3395
Copilot wants to merge 5 commits intomainfrom
copilot/fix-runtime-config-path-resolution

Conversation

Copy link
Contributor

Copilot AI commented Feb 14, 2026

runtimeConfigPath was copied verbatim into generated imports, causing incorrect paths when specified relative to project root.

// Config
{
  output: { path: 'src/client/schema1' },
  plugins: [{
    name: '@hey-api/client-axios',
    runtimeConfigPath: './src/client/config/schema1.config.ts'
  }]
}

// Before: incorrect import
import { createClientConfig } from './src/client/config/schema1.config.ts';

// After: correct import
import { createClientConfig } from '../config/schema1.config.ts';

Changes

  • Path resolution in @hey-api/client-core: Resolve paths starting with ./ or absolute paths from CWD, then compute relative path to output directory
  • Preserve existing behavior: Paths starting with ../ or bare names remain unchanged (already relative to output)

Implementation

Modified packages/openapi-ts/src/plugins/@hey-api/client-core/client.ts:

  • Detect path type via prefix (./ vs ../ vs bare)
  • Use path.resolve() and path.relative() to compute output-relative paths
  • Normalize to forward slashes with ./ or ../ prefix
Original prompt

This section details on the original issue you should resolve

<issue_title>runtimeConfigPath is copied verbatim instead of being resolved relative to generated output</issue_title>
<issue_description>### Description

Package: @hey-api/openapi-ts
Plugin: @hey-api/client-axios

Description

When using runtimeConfigPath with @hey-api/client-axios, the value is copied verbatim into the generated client files.

This causes incorrect imports unless the path is manually written relative to the generated output directory.

openapi-ts.config.ts:

import { defineConfig } from '@hey-api/openapi-ts';
import 'dotenv/config';

export default defineConfig([
  {
    input: `./schema1.json`,
    output: 'src/client/schema1',
    plugins: [
      '@hey-api/schemas',
      '@hey-api/sdk',
      '@hey-api/typescript',
      {
        name: '@hey-api/client-axios',
        runtimeConfigPath: './src/client/config/schema1.config.ts',
      },
    ],
  },
  {
    input: `./schema2.json`,
    output: 'src/client/schema2',
    plugins: [
      '@hey-api/schemas',
      '@hey-api/sdk',
      '@hey-api/typescript',
      {
        name: '@hey-api/client-axios',
        runtimeConfigPath: './src/client/config/schema2.config.ts',
      },
    ],
  },
]);

Generated Schema 1
import { createClientConfig } from './src/client/config/schema1.config.ts';

Generated Schema 2
import { createClientConfig } from './src/client/config/schema2.config.ts';

Reproducible example or configuration

https://stackblitz.com/edit/stackblitz-starters-z1bxoxgw?file=src%2Fclient%2Fschema1%2Fclient.gen.ts

OpenAPI specification (optional)

No response

System information (optional)

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@bolt-new-by-stackblitz
Copy link

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

@vercel
Copy link

vercel bot commented Feb 14, 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 Feb 14, 2026 10:23am

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 14, 2026

⚠️ No Changeset found

Latest commit: df48dba

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

Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Handle both absolute/CWD-relative paths and output-relative paths properly

Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
- Only resolve paths starting with './' or absolute paths
- Paths starting with '../' are kept as-is (already relative to output)
- Use path.resolve() without process.cwd() for cleaner code

Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix runtimeConfigPath handling in client-axios plugin Fix runtimeConfigPath resolution to be relative to output directory Feb 14, 2026
Copilot AI requested a review from mrlubos February 14, 2026 10:25
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.

runtimeConfigPath is copied verbatim instead of being resolved relative to generated output

2 participants