Skip to content

Make better union validation decisions based on extra behavior #1335

Open
@sydney-runkle

Description

@sydney-runkle

For example:

class ModelA(BaseModel):
    pass

class ModelB(BaseModel, extra='allow'):
    pass

TypeAdapter(ModelA | ModelB).validate_python({'x': 1})
#> ModelA()

Is the current behavior, but that doesn't seem like the best decision.

See #1332 and #1334 for recent context on union validation decision improvements.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions