title: How to over-write the pydantic model's validation message
body: <p>I want to change the validation message from pydantic model class, code for model class is below:</p>
  <pre class="lang-py prettyprint-override"><code>class Input(BaseModel):
      ip: IPvAnyAddress
  
      @validator(&quot;ip&quot;, always=True)
      def not_valid_ip(cls, v):
          &quot;&quot;&quot;To validate ip-address.&quot;&quot;&quot;
          if str(v) == &quot;&quot;:
              raise ValueError(f'Invalid IP-Address:: {v}')
          if not isinstance(v, IPvAnyAddress):
              raise ValueError(f'Invalid IP format:: {v}')
          return v
  </code></pre>
  <p>currently, it does not update the message written above. I am using fastAPI for API development.</p>
  <pre class="lang-py prettyprint-override"><code>{
      &quot;detail&quot;: [
          {
              &quot;loc&quot;: [
                  &quot;body&quot;,
                  &quot;input&quot;,
                  &quot;ip&quot;
              ],
              &quot;msg&quot;: &quot;value is not a valid IPv4 or IPv6 address&quot;,
              &quot;type&quot;: &quot;value_error.ipvanyaddress&quot;
          }
      ]
  }
  </code></pre>