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

Conversation

@malcolm-kee
Copy link
Contributor

@malcolm-kee malcolm-kee commented Aug 23, 2025

Currently the code assumes when a schema X has a allOf reference to another schema Y with discriminator, then schema X should respects that discriminator and add the discriminator.type with value set to the schema name of X (if there is no `discriminator.mapping refer to schema X).

However, schema X could also be extending schema Y, and in that case it should not add the discriminator.type property.

See first commit for the bug reproduction. It is causing QuxExtend type to becomes never.

See second commit for the fix. The assumption is if schema Y has oneOf and oneOf doesn't include schema X, then X is extending Y so it should not add discriminator.type to itself.

@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 23, 2025

🦋 Changeset detected

Latest commit: b81051e

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 23, 2025

@malcolm-kee is attempting to deploy a commit to the Hey API Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug 🔥 Something isn't working labels Aug 23, 2025
@malcolm-kee malcolm-kee force-pushed the fix/all-of-discriminator-extends branch from 3c1dfd1 to f0834c8 Compare August 23, 2025 17:33
@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 23, 2025

Open in StackBlitz

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

commit: b81051e

@codecov
Copy link

codecov bot commented Aug 23, 2025

Codecov Report

❌ Patch coverage is 0% with 54 lines in your changes missing coverage. Please review.
✅ Project coverage is 24.45%. Comparing base (462412f) to head (b81051e).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...ages/openapi-ts/src/openApi/3.0.x/parser/schema.ts 0.00% 26 Missing ⚠️
...ages/openapi-ts/src/openApi/3.1.x/parser/schema.ts 0.00% 26 Missing ⚠️
...enapi-ts/src/openApi/shared/utils/discriminator.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2515      +/-   ##
==========================================
- Coverage   24.46%   24.45%   -0.01%     
==========================================
  Files         344      344              
  Lines       34109    34120      +11     
  Branches     1496     1496              
==========================================
  Hits         8345     8345              
- Misses      25754    25765      +11     
  Partials       10       10              
Flag Coverage Δ
unittests 24.45% <0.00%> (-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.

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.

Love your pull requests, so clean! Thanks again!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 23, 2025
@mrlubos mrlubos merged commit c2b34a8 into hey-api:main Aug 23, 2025
10 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🔥 Something isn't working 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.

2 participants