Browse Source

use Union rather than | operator

pull/14463/head
DJ Melisso 7 months ago
parent
commit
b409e2fe43
  1. 3
      tests/test_additional_responses_no_mutation.py

3
tests/test_additional_responses_no_mutation.py

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

Loading…
Cancel
Save