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

Make discriminators work with multiple keys pointing to the same schema #1885

Merged
merged 3 commits into from
Mar 16, 2024

Conversation

ldej
Copy link
Contributor

@ldej ldej commented Mar 14, 2024

When multiple keys in a discriminator mapping point to the same schema, only the last key would become part of the discriminator literal. This PR takes into account that multiple keys might be pointing to the same schema.

Fixes #1878

Copy link

codspeed-hq bot commented Mar 14, 2024

CodSpeed Performance Report

Merging #1885 will not alter performance

Comparing ldej:duplicate-discriminator (cc6498d) with main (33d6666)

Summary

✅ 29 untouched benchmarks

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (main@33d6666). Click here to learn what that means.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1885   +/-   ##
=======================================
  Coverage        ?   98.89%           
=======================================
  Files           ?       37           
  Lines           ?     4158           
  Branches        ?      968           
=======================================
  Hits            ?     4112           
  Misses          ?       29           
  Partials        ?       17           
Flag Coverage Δ
unittests 98.55% <100.00%> (?)

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.

@koxudaxi koxudaxi merged commit 113dcd2 into koxudaxi:main Mar 16, 2024
92 checks passed
sthagen pushed a commit to sthagen/koxudaxi-datamodel-code-generator that referenced this pull request Mar 17, 2024
…ma (koxudaxi#1885)

* Make discriminators work with multiple keys pointing to the same schema

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Koudai Aono <koxudaxi@gmail.com>
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.

Discriminated Union with Literal with multiple values results in single Literal value
2 participants