title: Validating optional field in marshmallow
body: <p>I have a field in my model which is required in the resource body while creating the resource (POST) and is not passed in the request body(will be passed along with URL) while updating the resource (PUT).</p>
  
  <p>I have created my marshmallow model:</p>
  
  <pre><code>class DummySchema():
     field_1 = fields.Str(required=True)
     field_2 = fields.Id()
  </code></pre>
  
  <p>If I leave field_1 to <code>required=True</code>, I get the following error on <code>PUT</code> :</p>
  
  <pre><code>{
      "message": {
          "field_1": [
              "Missing data for required field."
          ]
      }
  }
  </code></pre>
  
  <p>I could leave it required in the model, but that would mean it would cause a problem in POST request.</p>
  
  <p>Is there a way I could set the field as optional, but set it required for my POST request so that I can perform my validation?</p>