这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@ixnas
Copy link
Contributor

@ixnas ixnas commented Aug 28, 2025

closes #2540

@bolt-new-by-stackblitz
Copy link

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

@changeset-bot
Copy link

changeset-bot bot commented Aug 28, 2025

🦋 Changeset detected

Latest commit: e42d2a1

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

This PR includes changesets to release 1 package
Name Type
@hey-api/openapi-ts 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

@vercel
Copy link

vercel bot commented Aug 28, 2025

Someone is attempting to deploy a commit to the Hey API Team on Vercel.

A member of the Team first needs to authorize it.

@ixnas ixnas changed the title feat: added support for generating const enum as enum type feat: add support for generating const enum as enum type Aug 28, 2025
@codecov
Copy link

codecov bot commented Aug 28, 2025

Codecov Report

❌ Patch coverage is 0% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 23.81%. Comparing base (774435e) to head (e42d2a1).
⚠️ Report is 35 commits behind head on main.

Files with missing lines Patch % Lines
...s/src/plugins/@hey-api/typescript/plugin-legacy.ts 0.00% 13 Missing ⚠️
...enapi-ts/src/plugins/@hey-api/typescript/plugin.ts 0.00% 7 Missing ⚠️
packages/openapi-ts/src/tsc/types.ts 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2541      +/-   ##
==========================================
- Coverage   24.00%   23.81%   -0.20%     
==========================================
  Files         359      361       +2     
  Lines       35540    36103     +563     
  Branches     1540     1560      +20     
==========================================
+ Hits         8533     8599      +66     
- Misses      26994    27491     +497     
  Partials       13       13              
Flag Coverage Δ
unittests 23.81% <0.00%> (-0.20%) ⬇️

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.

Copy link
Member

@mrlubos mrlubos left a comment

Choose a reason for hiding this comment

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

Once you fix the lint errors, please add a snapshot test and update snapshots with pnpm --filter @test/openapi-ts test:update

Copy link
Member

@mrlubos mrlubos left a comment

Choose a reason for hiding this comment

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

Looking good – thank you!

const pluginTypeScript = config.plugins['@hey-api/typescript'];
onNode(
tsc.enumDeclaration({
asConst:
Copy link
Member

Choose a reason for hiding this comment

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

I would've done just asConst: false, but this also works 😬

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. feature 🚀 New feature or request labels Aug 28, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 28, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 29, 2025

Open in StackBlitz

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

commit: e42d2a1

@ixnas
Copy link
Contributor Author

ixnas commented Aug 29, 2025

@mrlubos Why is my patch coverage 0%? I'd assume that the snapshot tests would cover the new paths, except maybe plugin-legacy.ts.

Functionality itself is working as expected now, so ready to merge if you ask me!

@ixnas ixnas requested a review from mrlubos August 29, 2025 10:01
@mrlubos
Copy link
Member

mrlubos commented Aug 29, 2025

@ixnas reports are broken, it shows project at ~24% as well. Your changes look good, thank you!

@mrlubos mrlubos merged commit 54e9939 into hey-api:main Aug 29, 2025
10 of 13 checks passed
@github-actions github-actions bot mentioned this pull request Aug 29, 2025
@ixnas ixnas deleted the feat/const-enum branch August 30, 2025 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 🚀 New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support generating const enum

2 participants