title: Is it possible to pass Path arguments into FastAPI dependency functions?
body: <p>Is there anyway for a FastAPI &quot;dependency&quot; to interpret Path parameters?</p>
  <p>I have a lot of functions of the form:</p>
  <pre class="lang-py prettyprint-override"><code>@app.post(&quot;/item/{item_id}/process&quot;, response_class=ProcessResponse)
  async def process_item(item_id: UUID, session: UserSession = Depends(security.user_session)) -&gt; ProcessResponse:
      item = await get_item(client_id=session.client_id, item_id=item_id)
      await item.process()
  </code></pre>
  <p>Over and over, I need to pass in [multiple] arguments to fetch the required item before doing something with it.  This is very repetitive and makes the code very verbose.  What I'd really like to do is pass the <code>item</code> in as an argument to the method.</p>
  <p>Ideally I'd like to make <code>get_item</code> a dependency or embed it somehow in the router. This would dramatically reduce the repetitive logic and excessively verbose function arguments.  The problem is that some critical arguments are passed by the client in the Path.</p>
  <p>Is it possible to pass Path arguments into a dependency or perhaps execute the dependency in the router and pass the result?</p>