- Sort Score
- Result 10 results
- Languages All
Results 1 - 1 of 1 for get_pet_type (0.05 sec)
-
tests/test_union_body_discriminator_annotated.py
meows: int class Dog(BaseModel): pet_type: str = "dog" barks: float def get_pet_type(v): assert isinstance(v, dict) return v.get("pet_type", "") Pet = Annotated[ Union[Annotated[Cat, Tag("cat")], Annotated[Dog, Tag("dog")]], Discriminator(get_pet_type), ] app = FastAPI() @app.post("/pet/assignment")Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 7.7K bytes - Viewed (0)