Skip to content

Conversation

@abuyukyi101198
Copy link

Added a 'response' option for the @hey-api/sdk config responseStyle parameter. Setting responseStyle to 'response' should directly return awaitSdkExpression without destructuring { data }, while keeping the SDK function returns the same.

Fixes: #2070

@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 Nov 5, 2025

🦋 Changeset detected

Latest commit: 69f219f

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

This PR includes changesets to release 13 packages
Name Type
@hey-api/openapi-ts Minor
@example/openapi-ts-angular-common Patch
@example/openapi-ts-angular Patch
@example/openapi-ts-fastify Patch
@example/openapi-ts-fetch Patch
@example/openapi-ts-ofetch Patch
@example/openapi-ts-openai Patch
@example/openapi-ts-pinia-colada Patch
@example/openapi-ts-tanstack-angular-query-experimental Patch
@example/openapi-ts-tanstack-react-query Patch
@example/openapi-ts-tanstack-svelte-query Patch
@example/openapi-ts-tanstack-vue-query Patch
@test/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 Nov 5, 2025

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

A member of the Team first needs to authorize it.

@mrlubos
Copy link
Member

mrlubos commented Nov 5, 2025

@abuyukyi101198 Doesn't fields do the same?

Add a changeset for WIP support of 'response' return in openapi-ts plugins.
@abuyukyi101198
Copy link
Author

@abuyukyi101198 Doesn't fields do the same?

I don't think so. The else-case seems to destructure to get { data } and return that.

if (plugin.getPluginOrThrow('@hey-api/sdk').config.responseStyle === 'data') {
    statements.push(
      tsc.returnVariable({
        expression: awaitSdkExpression,
      }),
    );
  } else {
    statements.push(
      tsc.constVariable({
        destructure: true,
        expression: awaitSdkExpression,
        name: 'data',
      }),
      tsc.returnVariable({
        expression: 'data',
      }),
    );
  }

@abuyukyi101198
Copy link
Author

abuyukyi101198 commented Nov 5, 2025

@mrlubos Using 'data' picks for the data field within the SDK, either way other fields of the response like headers seem to be discarded from what I understand.

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 27.95%. Comparing base (7b224f8) to head (69f219f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2935      +/-   ##
==========================================
- Coverage   27.95%   27.95%   -0.01%     
==========================================
  Files         346      346              
  Lines       33374    33380       +6     
  Branches     1921     1921              
==========================================
  Hits         9330     9330              
- Misses      24017    24023       +6     
  Partials       27       27              
Flag Coverage Δ
unittests 27.95% <ø> (-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.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 5, 2025

Open in StackBlitz

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

commit: 69f219f

@abuyukyi101198 abuyukyi101198 marked this pull request as ready for review November 5, 2025 16:03
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. client Client package related feature 🚀 New feature or request labels Nov 5, 2025
@abuyukyi101198
Copy link
Author

@mrlubos All tests pass, slightly reduced coverage

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

Labels

client Client package related 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.

TanStack Query: need last-modified from response header

2 participants