title: Unhashable type in FastAPI request
body: <p>I am writing a post-api using fastapi. The required request-format is:</p>
  <pre><code>{
     &quot;leadid&quot;:LD123,
     &quot;parties&quot;:[
        {
           &quot;uid&quot;:123123,
           &quot;cust_name&quot;:&quot;JOhn Doe&quot;,
        }, ...]}
  </code></pre>
  <p>The fastapi code in python is:</p>
  <pre><code>class Customer(BaseModel):
      UID: str
      CustName: str
  
  class PackageIn(BaseModel): 
      lead_id: str
      parties: Set[Customer]
      # threshold: Optional[int] = 85
  
  app = FastAPI()
  
  @app.post('/')
  async def nm_v2(package:PackageIn):
      return {&quot;resp&quot;:&quot;Response&quot;}
  </code></pre>
  <p>When I visit the SwaggerUI to submit the response, the error is <strong>&quot;422  Error: Unprocessable Entity&quot;</strong>. Also, the SwaggerUI doc states</p>
  <pre><code>{
    &quot;detail&quot;: [
      {
        &quot;loc&quot;: [
          &quot;body&quot;
        ],
        &quot;msg&quot;: &quot;unhashable type: 'Customer'&quot;,
        &quot;type&quot;: &quot;type_error&quot;
      }
    ]
  }
  </code></pre>
  <p>I do not know how to create this dict() structure for request payload without creating a separate pydantic based class called Customer. Pl tell me how to rectify the error.</p>