title: Request body validation with http Mux
body: <p>I am trying to build an API using Go and Mux. I am trying to validate the incoming requests. I tried using tags on Struct and validated it using <a href="https://github.com/go-playground/validator" rel="nofollow noreferrer">Go Validator</a>.</p>
  <p>This is my Struct</p>
  <pre><code>type Address struct {
      Street string `validate:&quot;required&quot;`
      City   string `validate:&quot;required&quot;`
      Phone  string `validate:&quot;required&quot;`
  }
  </code></pre>
  <p>My issue is</p>
  <ul>
  <li>There is a <code>POST</code> endpoint where all the fields would be passed and the validation would not fail. However there is another <code>PATCH</code> endpoint where not all fields of <code>Address</code> struct would be passed and hence the validation is failing.</li>
  </ul>
  <p>eg. API might receive</p>
  <pre><code>{
    &quot;Street&quot;: &quot;Dummy&quot;
  }
  </code></pre>
  <p>What is the best way to validate both <code>POST</code> and <code>PATCH</code> request in this scenario.</p>