existed_codes.append(add_response.status_code)
response_models: List[Any] = [m for m in add_response.models]
schema_field = None
- if add_response.content_type == "application/json" or lenient_issubclass(
- content_type, JSONResponse
- ) and len(response_models):
+ if (
+ add_response.content_type == "application/json"
+ or lenient_issubclass(content_type, JSONResponse)
+ and len(response_models)
+ ):
schema_field = Field(
name=f"Additional_response_{add_response.status_code}",
type_=Union[tuple(response_models)],
from fastapi import FastAPI
from fastapi.openapi.models import AdditionalResponse
from pydantic import BaseModel
-from pydantic.error_wrappers import ValidationError
from starlette.responses import JSONResponse
from starlette.testclient import TestClient