<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="from typing import Tuple
from fastapi import FastAPI
from pydantic import BaseModel


class FooArgs(BaseModel):
    bars: Tuple[str, str]


app = FastAPI()


@app.post(&quot;/foo&quot;)
def foo(args: FooArgs):
    ..."><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">typing</span> <span class="pl-k">import</span> <span class="pl-v">Tuple</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-k">from</span> <span class="pl-s1">pydantic</span> <span class="pl-k">import</span> <span class="pl-v">BaseModel</span>


<span class="pl-k">class</span> <span class="pl-v">FooArgs</span>(<span class="pl-v">BaseModel</span>):
    <span class="pl-s1">bars</span>: <span class="pl-v">Tuple</span>[<span class="pl-s1">str</span>, <span class="pl-s1">str</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">"/foo"</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">foo</span>(<span class="pl-s1">args</span>: <span class="pl-v">FooArgs</span>):
    ...</pre></div>
<h3 dir="auto">Description</h3>
<p dir="auto">If you try to retrieve the <code class="notranslate">/openapi.json</code>, the FooArgs get a validation error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  File &quot;.../lib/python3.9/site-packages/fastapi/openapi/utils.py&quot;, line 410, 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: 2 validation errors for OpenAPI
components -&gt; schemas -&gt; FooArgs -&gt; properties -&gt; bars -&gt; items
  value is not a valid dict (type=type_error.dict)
components -&gt; schemas -&gt; FooArgs -&gt; $ref
  field required (type=value_error.missing)"><pre class="notranslate"><code class="notranslate">  File ".../lib/python3.9/site-packages/fastapi/openapi/utils.py", line 410, 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: 2 validation errors for OpenAPI
components -&gt; schemas -&gt; FooArgs -&gt; properties -&gt; bars -&gt; items
  value is not a valid dict (type=type_error.dict)
components -&gt; schemas -&gt; FooArgs -&gt; $ref
  field required (type=value_error.missing)
</code></pre></div>
<p dir="auto">This error is new to <code class="notranslate">fastapi&gt;=0.68</code>, it <strong>does not</strong> happen with <code class="notranslate">fastapi==0.67.0</code>.</p>
<p dir="auto">I think this is related to Pydantic coercing <code class="notranslate">Tuple[str, str]</code> into <code class="notranslate">Dict[str, str]</code> somewhere?</p>
<p dir="auto">Things that don't cause this error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class FooArgs(BaseModel):
    bars: Tuple[str]"><pre class="notranslate"><code class="notranslate">class FooArgs(BaseModel):
    bars: Tuple[str]
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class FooArgs(BaseModel):
    bars: Tuple[str, ...]"><pre class="notranslate"><code class="notranslate">class FooArgs(BaseModel):
    bars: Tuple[str, ...]
</code></pre></div>
<p dir="auto">This that do cause this error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class FooArgs(BaseModel):
    bars: Tuple[str, str]"><pre class="notranslate"><code class="notranslate">class FooArgs(BaseModel):
    bars: Tuple[str, str]
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class FooArgs(BaseModel):
    bars: Tuple[int, str]"><pre class="notranslate"><code class="notranslate">class FooArgs(BaseModel):
    bars: Tuple[int, str]
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class FooArgs(BaseModel):
    bars: Tuple[str, str, str]  # etc."><pre class="notranslate"><code class="notranslate">class FooArgs(BaseModel):
    bars: Tuple[str, str, str]  # etc.
</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.1</p>
<h3 dir="auto">Python Version</h3>
<p dir="auto">3.9.1 (also seeing this in 3.8.*)</p>
<h3 dir="auto">Additional Context</h3>
<p dir="auto">Seems pretty likely that this commit introduced it, but there's a lot going on so I'm not sure where:</p>
<p dir="auto"><a class="commit-link" href="https://github.com/tiangolo/fastapi/commit/97fa743ecb5a716fa0223a7463cb83f3f0df494c#diff-4939896f79697822446463d5d6dfbf7a0ea5805c46565d355c7305d86f3405c7"><tt>97fa743</tt>#diff-4939896f79697822446463d5d6dfbf7a0ea5805c46565d355c7305d86f3405c7</a></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>