fix: access discriminator field on BaseModel instance using key (#3847)

When validating a discriminated union where the union value has been
passed as a Pydantic model instance, we should access the discriminator
field value using the field name and not the field alias (whether one is
set or not).
This commit is contained in:
Charlie Hornsby
2022-08-08 16:43:23 +03:00
committed by GitHub
parent e92f12efac
commit cd439a4e8d
3 changed files with 20 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
Fix validation of discriminated union fields with an alias when passing a model instance