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: discriminator key used when discriminator has alias and .schema(by_alias=False) #10146

Conversation

exs-dwoodward
Copy link
Contributor

@exs-dwoodward exs-dwoodward commented Aug 15, 2024

Change Summary

Fixes an issue in pydantic v1 whereby a discriminated union model where the discriminated field has an alias does not get the field name propagated to the schema's discriminator.propertyName when the model has .schema(by_alias=False) called.

Related issue number

fix #10131

skip change file check

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

skip file change check

Selected Reviewer: @samuelcolvin

@exs-dwoodward
Copy link
Contributor Author

please review

@exs-dwoodward
Copy link
Contributor Author

@sydney-runkle FYI!

@exs-dwoodward
Copy link
Contributor Author

not too sure why the check-dist make check is failing - passes locally 🤔

Copy link
Member

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Thanks for adding a thorough test!

@sydney-runkle
Copy link
Member

@exs-dwoodward, yeah, a bit odd. Seems like this was fixed in #10139.

@sydney-runkle sydney-runkle enabled auto-merge (squash) August 15, 2024 12:54
@sydney-runkle sydney-runkle merged commit e1ecbf2 into pydantic:1.10.X-fixes Aug 15, 2024
60 checks passed
@sydney-runkle sydney-runkle changed the title fix: discriminator key used when discriminator has alias and schema g… fix: discriminator key used when discriminator has alias and .schema(by_alias=False) Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants