title: Change Pydantic's inherited BaseModel's attribute precedence in JSON schema
body: <p>I'm using <code>pydantic 1.6.1</code> and <code>fastapi 0.61.1</code> with Python 3.8.3. Here's how I've tried defining the models:</p>
  <pre><code>class UserBase(BaseModel):
      name: str
  
  class UserCreate(UserBase):
      password: str
  
  class UserInfo(UserBase):
      id: str
      group: Optional[GroupInfo] = None
  </code></pre>
  <p>The issue I'm having with this setup is that the schema is built such that the <code>name</code> attribute is on top of the remaining attributes like so - in this case, while using <code>UserInfo</code> as the endpoint's <code>response_model</code>:</p>
  <pre><code>[
    {
      &quot;name&quot;: &quot;string&quot;,
      &quot;id&quot;: &quot;string&quot;,
      &quot;group&quot;: {
        &quot;name&quot;: &quot;string&quot;
      }
    }
  ]
  </code></pre>
  <p>Yet I'd like to be able to set them up like this:</p>
  <pre><code>[
    {
      &quot;id&quot;: &quot;string&quot;,
      &quot;name&quot;: &quot;string&quot;,
      &quot;group&quot;: {
        &quot;name&quot;: &quot;string&quot;
      }
    }
  ]
  </code></pre>
  <p>Is there a way I can manually set a custom order for the attributes in the JSON response's schema?</p>