mirror of https://github.com/tiangolo/fastapi.git
3.9 union
This commit is contained in:
parent
ef3c5fa1f1
commit
07ceed403d
|
|
@ -155,12 +155,12 @@ def test_required_dict_union(path: str):
|
|||
|
||||
|
||||
@app.get("/required-dict-of-union")
|
||||
async def read_required_dict_of_union(p: Annotated[dict[str, int | bool], Query()]):
|
||||
async def read_required_dict_of_union(p: Annotated[dict[str, Union[int, bool]], Query()]):
|
||||
return {"p": p}
|
||||
|
||||
|
||||
class QueryModelRequiredDictOfUnion(BaseModel):
|
||||
p: dict[str, int | bool]
|
||||
p: dict[str, Union[int, bool]]
|
||||
|
||||
|
||||
@app.get("/model-required-dict-of-union")
|
||||
|
|
|
|||
Loading…
Reference in New Issue