<h3 dir="auto">First Check</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I added a very descriptive title to this issue.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I used the GitHub search to find a similar issue and didn't find it.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I searched the FastAPI documentation, with the integrated search.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already searched in Google "How to X in FastAPI" and didn't find any information.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already read and followed all the tutorial in the docs and didn't find an answer.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already checked if it is not related to FastAPI but to <a href="https://github.com/samuelcolvin/pydantic">Pydantic</a>.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already checked if it is not related to FastAPI but to <a href="https://github.com/swagger-api/swagger-ui">Swagger UI</a>.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already checked if it is not related to FastAPI but to <a href="https://github.com/Redocly/redoc">ReDoc</a>.</li>
</ul>
<h3 dir="auto">Commit to Help</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I commit to help with one of those options 👆</li>
</ul>
<h3 dir="auto">Example Code</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from fastapi import FastAPI
from pydantic import BaseModel, confloat

app = FastAPI()

LngLat = Tuple[confloat(ge=-180.0, le=180.0), confloat(ge=-90, le=90)]

class Viewport(BaseModel):
    sw: LngLat
    ne: LngLat

@app.get('/viewport', response_model=Viewport)
def get_viewport():
    return Viewport(sw=[-93, 36], ne=[-92, 37])"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">fastapi</span> <span class="pl-k">import</span> <span class="pl-v">FastAPI</span>
<span class="pl-k">from</span> <span class="pl-s1">pydantic</span> <span class="pl-k">import</span> <span class="pl-v">BaseModel</span>, <span class="pl-s1">confloat</span>

<span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-v">FastAPI</span>()

<span class="pl-v">LngLat</span> <span class="pl-c1">=</span> <span class="pl-v">Tuple</span>[<span class="pl-en">confloat</span>(<span class="pl-s1">ge</span><span class="pl-c1">=</span><span class="pl-c1">-</span><span class="pl-c1">180.0</span>, <span class="pl-s1">le</span><span class="pl-c1">=</span><span class="pl-c1">180.0</span>), <span class="pl-en">confloat</span>(<span class="pl-s1">ge</span><span class="pl-c1">=</span><span class="pl-c1">-</span><span class="pl-c1">90</span>, <span class="pl-s1">le</span><span class="pl-c1">=</span><span class="pl-c1">90</span>)]

<span class="pl-k">class</span> <span class="pl-v">Viewport</span>(<span class="pl-v">BaseModel</span>):
    <span class="pl-s1">sw</span>: <span class="pl-v">LngLat</span>
    <span class="pl-s1">ne</span>: <span class="pl-v">LngLat</span>

<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-en">get</span>(<span class="pl-s">'/viewport'</span>, <span class="pl-s1">response_model</span><span class="pl-c1">=</span><span class="pl-v">Viewport</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">get_viewport</span>():
    <span class="pl-k">return</span> <span class="pl-v">Viewport</span>(<span class="pl-s1">sw</span><span class="pl-c1">=</span>[<span class="pl-c1">-</span><span class="pl-c1">93</span>, <span class="pl-c1">36</span>], <span class="pl-s1">ne</span><span class="pl-c1">=</span>[<span class="pl-c1">-</span><span class="pl-c1">92</span>, <span class="pl-c1">37</span>])</pre></div>
<h3 dir="auto">Description</h3>
<p dir="auto">The example code I've provided causes the openapi docs page to crash, with the following error displayed:</p>
<blockquote>
<p dir="auto"><strong>Failed to load API definition.</strong><br>
<strong>Errors<br>
Fetch error</strong><br>
Internal Server Error    /openapi.json</p>
</blockquote>
<p dir="auto">Due to the following stack trace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  File &quot;/Users/hansbrende/miniconda3/envs/facade-api/lib/python3.8/site-packages/fastapi/applications.py&quot;, line 161, in openapi
    return JSONResponse(self.openapi())
  File &quot;/Users/hansbrende/miniconda3/envs/facade-api/lib/python3.8/site-packages/fastapi/applications.py&quot;, line 136, in openapi
    self.openapi_schema = get_openapi(
  File &quot;/Users/hansbrende/miniconda3/envs/facade-api/lib/python3.8/site-packages/fastapi/openapi/utils.py&quot;, line 411, in get_openapi
    return jsonable_encoder(OpenAPI(**output), by_alias=True, exclude_none=True)  # type: ignore
  File &quot;pydantic/main.py&quot;, line 406, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 3 validation errors for OpenAPI
components -&gt; schemas -&gt; Viewport -&gt; properties -&gt; sw -&gt; items
  value is not a valid dict (type=type_error.dict)
components -&gt; schemas -&gt; Viewport -&gt; properties -&gt; ne -&gt; items
  value is not a valid dict (type=type_error.dict)
components -&gt; schemas -&gt; Viewport -&gt; $ref
  field required (type=value_error.missing)"><pre class="notranslate"><code class="notranslate">  File "/Users/hansbrende/miniconda3/envs/facade-api/lib/python3.8/site-packages/fastapi/applications.py", line 161, in openapi
    return JSONResponse(self.openapi())
  File "/Users/hansbrende/miniconda3/envs/facade-api/lib/python3.8/site-packages/fastapi/applications.py", line 136, in openapi
    self.openapi_schema = get_openapi(
  File "/Users/hansbrende/miniconda3/envs/facade-api/lib/python3.8/site-packages/fastapi/openapi/utils.py", line 411, in get_openapi
    return jsonable_encoder(OpenAPI(**output), by_alias=True, exclude_none=True)  # type: ignore
  File "pydantic/main.py", line 406, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 3 validation errors for OpenAPI
components -&gt; schemas -&gt; Viewport -&gt; properties -&gt; sw -&gt; items
  value is not a valid dict (type=type_error.dict)
components -&gt; schemas -&gt; Viewport -&gt; properties -&gt; ne -&gt; items
  value is not a valid dict (type=type_error.dict)
components -&gt; schemas -&gt; Viewport -&gt; $ref
  field required (type=value_error.missing)
</code></pre></div>
<h3 dir="auto">Operating System</h3>
<p dir="auto">macOS</p>
<h3 dir="auto">Operating System Details</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">FastAPI Version</h3>
<p dir="auto">0.68.0</p>
<h3 dir="auto">Python Version</h3>
<p dir="auto">Python 3.8.10</p>
<h3 dir="auto">Additional Context</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">First Check</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I added a very descriptive title to this issue.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I used the GitHub search to find a similar issue and didn't find it.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I searched the FastAPI documentation, with the integrated search.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already searched in Google "How to X in FastAPI" and didn't find any information.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already read and followed all the tutorial in the docs and didn't find an answer.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already checked if it is not related to FastAPI but to <a href="https://github.com/samuelcolvin/pydantic">Pydantic</a>.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already checked if it is not related to FastAPI but to <a href="https://github.com/swagger-api/swagger-ui">Swagger UI</a>.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already checked if it is not related to FastAPI but to <a href="https://github.com/Redocly/redoc">ReDoc</a>.</li>
</ul>
<h3 dir="auto">Commit to Help</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I commit to help with one of those options <g-emoji class="g-emoji" alias="point_up_2" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f446.png">👆</g-emoji></li>
</ul>
<h3 dir="auto">Example Code</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# main.py

import uvicorn
from fastapi import FastAPI, Form

app = FastAPI()

@app.post(&quot;/&quot;)
def hello(arg: tuple[int, int] = Form(...)) -&gt; str:
    pass

if __name__ == &quot;__main__&quot;:
    uvicorn.run(&quot;main:app&quot;, port=8080)"><pre class="notranslate"><span class="pl-c"># main.py</span>

<span class="pl-k">import</span> <span class="pl-s1">uvicorn</span>
<span class="pl-k">from</span> <span class="pl-s1">fastapi</span> <span class="pl-k">import</span> <span class="pl-v">FastAPI</span>, <span class="pl-v">Form</span>

<span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-v">FastAPI</span>()

<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-en">post</span>(<span class="pl-s">"/"</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">hello</span>(<span class="pl-s1">arg</span>: <span class="pl-s1">tuple</span>[<span class="pl-s1">int</span>, <span class="pl-s1">int</span>] <span class="pl-c1">=</span> <span class="pl-v">Form</span>(...)) <span class="pl-c1">-&gt;</span> <span class="pl-s1">str</span>:
    <span class="pl-k">pass</span>

<span class="pl-k">if</span> <span class="pl-s1">__name__</span> <span class="pl-c1">==</span> <span class="pl-s">"__main__"</span>:
    <span class="pl-s1">uvicorn</span>.<span class="pl-en">run</span>(<span class="pl-s">"main:app"</span>, <span class="pl-s1">port</span><span class="pl-c1">=</span><span class="pl-c1">8080</span>)</pre></div>
<h3 dir="auto">Description</h3>
<ol dir="auto">
<li>Run <code class="notranslate">pip install uvicorn fastapi==0.68.0</code>.</li>
<li>Run <code class="notranslate">python ./main.py</code></li>
<li>Hit <code class="notranslate">localhost:8080/docs</code>, observe internal server error with below validation errors:</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="pydantic.error_wrappers.ValidationError: 2 validation errors for OpenAPI
components -&gt; schemas -&gt; Body_hello__post -&gt; properties -&gt; arg -&gt; items
  value is not a valid dict (type=type_error.dict)
components -&gt; schemas -&gt; Body_hello__post -&gt; $ref
  field required (type=value_error.missing)"><pre class="notranslate"><code class="notranslate">pydantic.error_wrappers.ValidationError: 2 validation errors for OpenAPI
components -&gt; schemas -&gt; Body_hello__post -&gt; properties -&gt; arg -&gt; items
  value is not a valid dict (type=type_error.dict)
components -&gt; schemas -&gt; Body_hello__post -&gt; $ref
  field required (type=value_error.missing)
</code></pre></div>
<ol start="4" dir="auto">
<li>Run <code class="notranslate">pip install fastapi==0.67.0</code></li>
<li>Hit <code class="notranslate">localhost:8080/docs</code>, observe that endpoint documentation is successfully generated.</li>
</ol>
<h3 dir="auto">Operating System</h3>
<p dir="auto">Linux</p>
<h3 dir="auto">Operating System Details</h3>
<p dir="auto">Ubuntu 20.04</p>
<h3 dir="auto">FastAPI Version</h3>
<p dir="auto">0.68.0 has bug, 0.67.0 does not have bug.</p>
<h3 dir="auto">Python Version</h3>
<p dir="auto">3.9</p>
<h3 dir="auto">Additional Context</h3>
<p dir="auto">Any use of <code class="notranslate">tuple</code> in an input (<code class="notranslate">Form</code>, and <code class="notranslate">BaseModel</code> as JSON) or output (<code class="notranslate">BaseModel</code> as JSON) results in above error.</p>