Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle tree-shakeable angular client case #973

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

jacobinu
Copy link
Collaborator

Fixes #638

Example configuration:
npx @hey-api/openapi-ts -c angular -i .\api\swaggger\auth-swagger.json -o .\api\generated\auth\

Use anonymous functions instead of arrow functions in the generated services.ts code. This allow callers to bind this to pass Angular's HttpClient.

getUser.call(this, {
  requestBody: {
    userName: "Test",
  }
});

Copy link

stackblitz bot commented Aug 26, 2024

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

Copy link

changeset-bot bot commented Aug 26, 2024

🦋 Changeset detected

Latest commit: 8f7a14f

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

Copy link

vercel bot commented Aug 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hey-api-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 26, 2024 2:07am

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.

This looks like a nice fix, thank you @jacobinu. Can you please add a changelog entry and update snapshots so it will pass tests?

@jacobinu
Copy link
Collaborator Author

Done, hopefully formatted the changelog correctly.

Copy link

codecov bot commented Aug 26, 2024

Codecov Report

Attention: Patch coverage is 24.44444% with 34 lines in your changes missing coverage. Please review.

Project coverage is 76.42%. Comparing base (7e84960) to head (8f7a14f).
Report is 2 commits behind head on main.

Files Patch % Lines
packages/openapi-ts/src/compiler/types.ts 13.15% 33 Missing ⚠️
packages/openapi-ts/src/generate/services.ts 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #973      +/-   ##
==========================================
- Coverage   76.64%   76.42%   -0.22%     
==========================================
  Files          89       89              
  Lines       10868    10911      +43     
  Branches     1110     1111       +1     
==========================================
+ Hits         8330     8339       +9     
- Misses       2531     2565      +34     
  Partials        7        7              
Flag Coverage Δ
unittests 76.42% <24.44%> (-0.22%) ⬇️

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.

Copy link

pkg-pr-new bot commented Aug 26, 2024

commit: 8f7a14f

pnpm add https://pkg.pr.new/@hey-api/client-axios@973
pnpm add https://pkg.pr.new/@hey-api/client-fetch@973
pnpm add https://pkg.pr.new/@hey-api/openapi-ts@973

Open in Stackblitz

@mrlubos mrlubos merged commit 26f2b68 into hey-api:main Aug 26, 2024
15 of 17 checks passed
@github-actions github-actions bot mentioned this pull request Aug 26, 2024
@jacobinu jacobinu deleted the fix/angular-tree-shakeable branch August 28, 2024 03:18
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.

Generated angular client produces compile error due to tree shaking in services
2 participants