Skip to content

Conversation

carson2222
Copy link
Member

@carson2222 carson2222 commented Sep 5, 2025

Work in progress

TODO:

  • Accept multiple configs
  • Accept multiple inputs in one config
  • Accept multiple outputs in one config

close #1056
close #1995
close #564

Copy link

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

Copy link

changeset-bot bot commented Sep 5, 2025

🦋 Changeset detected

Latest commit: c84f10e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@hey-api/openapi-ts Minor
@hey-api/custom-client Patch
@hey-api/codegen-core Patch
@hey-api/vite-plugin Patch
@hey-api/nuxt Patch
@docs/openapi-ts Patch
@example/openapi-ts-nuxt Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link

vercel bot commented Sep 5, 2025

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

Project Deployment Preview Comments Updated (UTC)
hey-api-docs Ready Ready Preview Comment Sep 11, 2025 2:41pm

@carson2222 carson2222 force-pushed the feat--multiple-configs-functionality branch from 2c662b0 to 1450461 Compare September 11, 2025 11:43
@carson2222 carson2222 marked this pull request as ready for review September 11, 2025 11:44
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. feature 🚀 New feature or request labels Sep 11, 2025
| (string & {})
| (Record<string, unknown> & { path?: never })
| Input;
input: InputPath | Input | (InputPath | Input)[];
Copy link
Member

Choose a reason for hiding this comment

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

use readonly arrays please

Suggested change
input: InputPath | Input | (InputPath | Input)[];
input: InputPath | Input | ReadonlyArray<InputPath | Input>;

*/
output: string | Output;
output: string | Output | (string | Output)[];
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
output: string | Output | (string | Output)[];
output: string | Output | ReadonlyArray<string | Output>;

Copy link

codecov bot commented Sep 11, 2025

Codecov Report

❌ Patch coverage is 44.27861% with 112 lines in your changes missing coverage. Please review.
✅ Project coverage is 28.76%. Comparing base (91bc2d0) to head (c84f10e).

Files with missing lines Patch % Lines
packages/openapi-ts/src/getSpec.ts 26.22% 90 Missing ⚠️
packages/openapi-ts/src/index.ts 18.18% 9 Missing ⚠️
packages/openapi-ts/src/config/init.ts 83.78% 6 Missing ⚠️
packages/openapi-ts/src/createClient.ts 75.00% 6 Missing ⚠️
packages/openapi-ts/src/config/output.ts 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2602      +/-   ##
==========================================
+ Coverage   23.81%   28.76%   +4.95%     
==========================================
  Files         379      379              
  Lines       36945    37029      +84     
  Branches     1623     2084     +461     
==========================================
+ Hits         8798    10651    +1853     
+ Misses      28134    26343    -1791     
- Partials       13       35      +22     
Flag Coverage Δ
unittests 28.76% <44.27%> (+4.95%) ⬆️

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.

@@ -103,7 +107,7 @@ export const createClient = async (
/**
* Type helper for openapi-ts.config.ts, returns {@link UserConfig} object
*/
export const defineConfig = async (config: Configs): Promise<UserConfig> =>
export const defineConfig = async (config: Configs): Promise<ConfigValue> =>
Copy link
Member

Choose a reason for hiding this comment

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

I didn't play with this but guessing it won't currently know which value it returns. I think you could use generics to make sure it's properly typed, i.e. object -> object and array -> array. Currently it should be object -> object | array and array -> object | array. Assuming it's always going to be 1:1, we want to improve these types

@mrlubos
Copy link
Member

mrlubos commented Sep 11, 2025

Without digging into the code, are you internally converting all configs to an array? So what was before config is now [config] and users can also do [config] manually or [config1, config2] but it's always an array internally?

@carson2222
Copy link
Member Author

Without digging into the code, are you internally converting all configs to an array? So what was before config is now [config] and users can also do [config] manually or [config1, config2] but it's always an array internally?

Basically yes

Copy link

pkg-pr-new bot commented Sep 11, 2025

Open in StackBlitz

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/codegen-core@2602
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/nuxt@2602
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/openapi-ts@2602
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/vite-plugin@2602

commit: c84f10e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🚀 New feature or request size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request support multiple schemas Generating code based on multiple OpenAPI schemas Multiple configurations/specifying a configuration file
2 participants