junmanbo / tutong

0 stars 0 forks source link

포트폴리오 가져올 때 response validation 에러 #2

Closed junmanbo closed 1 year ago

junmanbo commented 1 year ago

에러 메시지:

INFO:     127.0.0.1:40098 - "GET /api/v1/portfolio?portfolio_id=1 HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 426, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/fastapi/applications.py", line 289, in __call__
    await super().__call__(scope, receive, send)
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/starlette/middleware/cors.py", line 83, in __call__
    await self.app(scope, receive, send)
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
    raise e
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
    await self.app(scope, receive, send)
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/fastapi/routing.py", line 291, in app
    content = await serialize_response(
  File "/home/jun/.cache/pypoetry/virtualenvs/app-mTxnZhaR-py3.10/lib/python3.10/site-packages/fastapi/routing.py", line 154, in serialize_response
    raise ResponseValidationError(
fastapi.exceptions.ResponseValidationError

response_model=schemas.Portfolio 로 되어 있고, Portfolio 스키마에 portfolio_ticker 와 ticker 를 같이 불러오도록 되어 있다. 이 부분에서 에러 발생하는 것으로 추정.

junmanbo commented 1 year ago