title: Partial update in FastAPI
body: <p>I want to implement a put or patch request in FastAPI that supports partial update. <a href="https://fastapi.tiangolo.com/tutorial/body-updates/" rel="nofollow noreferrer">The official documentation</a> is really confusing and I can't figure out how to do the request. (I don't know that <code>items</code> is in the documentation since my data will be passed with request's body, not a hard-coded dict).</p>
  <pre><code>class QuestionSchema(BaseModel):
      title: str = Field(..., min_length=3, max_length=50)
      answer_true: str = Field(..., min_length=3, max_length=50)
      answer_false: List[str] = Field(..., min_length=3, max_length=50)
      category_id: int
  
  
  class QuestionDB(QuestionSchema):
      id: int
  
  
  async def put(id: int, payload: QuestionSchema):
      query = (
          questions
          .update()
          .where(id == questions.c.id)
          .values(**payload)
          .returning(questions.c.id)
      )
      return await database.execute(query=query)
  
  @router.put(&quot;/{id}/&quot;, response_model=QuestionDB)
  async def update_question(payload: QuestionSchema, id: int = Path(..., gt=0),):
      question = await crud.get(id)
      if not question:
          raise HTTPException(status_code=404, detail=&quot;question not found&quot;)
  
      ## what should be the stored_item_data, as documentation?
      stored_item_model = QuestionSchema(**stored_item_data)
      update_data = payload.dict(exclude_unset=True)
      updated_item = stored_item_model.copy(update=update_data)
  
      response_object = {
          &quot;id&quot;: question_id,
          &quot;title&quot;: payload.title,
          &quot;answer_true&quot;: payload.answer_true,
          &quot;answer_false&quot;: payload.answer_false,
          &quot;category_id&quot;: payload.category_id,
      }
      return response_object
  
  </code></pre>
  <p>How can I complete my code to get a successful partial update here?</p>