<h3 dir="auto">Description</h3>
<p dir="auto">Just like the author of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="527656071" data-permission-text="Title is private" data-url="https://github.com/tiangolo/fastapi/issues/731" data-hovercard-type="issue" data-hovercard-url="/tiangolo/fastapi/issues/731/hovercard" href="https://github.com/tiangolo/fastapi/issues/731">#731</a>, I don't want a 307 temporary redirect which is automatically sent by uvicorn when there's a missing trailing slash in the api call. However, the solution given in that issue, i.e. route path like "/?" no longer works in the versions after this April as reported in in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="665405788" data-permission-text="Title is private" data-url="https://github.com/tiangolo/fastapi/issues/1787" data-hovercard-type="issue" data-hovercard-url="/tiangolo/fastapi/issues/1787/hovercard" href="https://github.com/tiangolo/fastapi/issues/1787">#1787</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="647771966" data-permission-text="Title is private" data-url="https://github.com/tiangolo/fastapi/issues/1648" data-hovercard-type="issue" data-hovercard-url="/tiangolo/fastapi/issues/1648/hovercard" href="https://github.com/tiangolo/fastapi/issues/1648">#1648</a> and else. Certain developers states this is an unexpected behavior and won't be supported in the future. In this case, I'm wondering what is the current elegant way to realize this. Or there's any way to handle both "" and "/" two paths simultaneously?</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>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> After submitting this, I commit to one of:
<ul dir="auto">
<li>Read open issues with questions until I find 2 issues where I can help someone and add a comment to help there.</li>
<li>I already hit the "watch" button in this repository to receive notifications and I commit to help at least 2 people that ask questions in the future.</li>
<li>Implement a Pull Request for a confirmed bug.</li>
</ul>
</li>
</ul>

<h3 dir="auto">Example</h3>
<p dir="auto">Here's a self-contained, example with my use case. :</p>

<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from fastapi import FastAPI

app = FastAPI()

@app.post(&quot;/{name}&quot;)
def read_root(name):
    &quot;&quot;&quot;
    Some descriptive doc-string
    &quot;&quot;&quot;
    return f&quot;Hello {name}&quot;"><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-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">"/{name}"</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">read_root</span>(<span class="pl-s1">name</span>):
    <span class="pl-s">"""</span>
<span class="pl-s">    Some descriptive doc-string</span>
<span class="pl-s">    """</span>
    <span class="pl-k">return</span> <span class="pl-s">f"Hello <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">name</span><span class="pl-kos">}</span></span>"</span></pre></div>
<h3 dir="auto">Description</h3>

<ul dir="auto">
<li>Open the browser and call the endpoint <code class="notranslate">/</code>.</li>
<li>Navigate to the /docs</li>
<li>note that swagger can allow you to set examples for the query param, but there is no obvious way to do this with swagger docs generated from fast api.</li>
</ul>
<h3 dir="auto">Environment</h3>
<p dir="auto">osx, plus from pip freeze:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="certifi==2020.12.5
click==7.1.2
fastapi==0.63.0
h11==0.12.0
pydantic==1.8
starlette==0.13.6
typing-extensions==3.7.4.3
uvicorn==0.13.4"><pre class="notranslate"><code class="notranslate">certifi==2020.12.5
click==7.1.2
fastapi==0.63.0
h11==0.12.0
pydantic==1.8
starlette==0.13.6
typing-extensions==3.7.4.3
uvicorn==0.13.4
</code></pre></div>
<ul dir="auto">
<li>Python version: 3.8</li>
</ul>
<h3 dir="auto">Additional context</h3>
<p dir="auto">Is there some pattern with pydoc or something with setting examples that I am mising? or with pydantic?</p>
<p dir="auto">I would like to be able to use the swagger docs for some endpoint development, so it would be great to be able to use swagger to remember an example UUID for example, so speed up the tests, and let me skip duplicating all the endpoints to postman.</p>