use Union rather than | operator

This commit is contained in:
DJ Melisso 2025-12-14 17:10:51 -08:00
parent a63fc91182
commit b409e2fe43
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ don't accumulate duplicate $ref entries in anyOf arrays.
See https://github.com/fastapi/fastapi/pull/14463
"""
from typing import Union
from fastapi import FastAPI
from fastapi.testclient import TestClient
from pydantic import BaseModel
@ -20,7 +21,7 @@ class ModelB(BaseModel):
app = FastAPI(
responses={
500: {
"model": ModelA | ModelB,
"model": Union[ModelA, ModelB],
"content": {"application/json": {"examples": {"Case A": {"value": "a"}}}},
}
}