Skip to content

fix(shared): support non-string discriminator property types#3385

Open
SipanP wants to merge 1 commit intohey-api:mainfrom
SipanP:fix/discriminator-non-string-type-support
Open

fix(shared): support non-string discriminator property types#3385
SipanP wants to merge 1 commit intohey-api:mainfrom
SipanP:fix/discriminator-non-string-type-support

Conversation

@SipanP
Copy link

@SipanP SipanP commented Feb 12, 2026

OpenAPI discriminator mappings use string keys, but the actual discriminator property may be boolean, integer, or number. Previously, all discriminator values were hardcoded as type 'string'. This change detects the actual property type from the schema and converts mapping values accordingly.

OpenAPI discriminator mappings use string keys, but the actual discriminator
property may be boolean, integer, or number. Previously, all discriminator
values were hardcoded as type 'string'. This change detects the actual
property type from the schema and converts mapping values accordingly.
@bolt-new-by-stackblitz
Copy link

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

@vercel
Copy link

vercel bot commented Feb 12, 2026

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

A member of the Team first needs to authorize it.

@changeset-bot
Copy link

changeset-bot bot commented Feb 12, 2026

🦋 Changeset detected

Latest commit: 9ef2705

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

This PR includes changesets to release 3 packages
Name Type
@hey-api/shared Patch
@hey-api/openapi-python Patch
@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

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. bug 🔥 Broken or incorrect behavior. labels Feb 12, 2026
@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

❌ Patch coverage is 3.88350% with 99 lines in your changes missing coverage. Please review.
✅ Project coverage is 33.37%. Comparing base (5627f12) to head (9ef2705).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/shared/src/openApi/3.1.x/parser/schema.ts 3.12% 22 Missing and 9 partials ⚠️
packages/shared/src/openApi/3.0.x/parser/schema.ts 3.70% 18 Missing and 8 partials ⚠️
...s/shared/src/openApi/shared/utils/discriminator.ts 4.34% 18 Missing and 4 partials ⚠️
packages/shared/src/openApi/2.0.x/parser/schema.ts 4.76% 14 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3385      +/-   ##
==========================================
- Coverage   33.55%   33.37%   -0.18%     
==========================================
  Files         447      447              
  Lines       16092    16188      +96     
  Branches     4935     4983      +48     
==========================================
+ Hits         5399     5403       +4     
- Misses       8611     8676      +65     
- Partials     2082     2109      +27     
Flag Coverage Δ
unittests 33.37% <3.88%> (-0.18%) ⬇️

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.

@mrlubos
Copy link
Member

mrlubos commented Feb 12, 2026

@SipanP are you able to resolve the typecheck fail? And since OpenAPI 2.0 parser was affected, can you add a spec + test the same way you did for 3.x? Looks good otherwise!

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

Labels

bug 🔥 Broken or incorrect behavior. size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants