title: How to accept None for String type field when using Flask-RESTPlus
body: <hr>
  
  <p>I am just starting develop with flask-restplus and I am not a native speaker,</p>
  
  <p>but I will try to describe my question as clear as I can.</p>
  
  <p>I know there is a <code>fields</code> module in <a href="https://flask-restplus.readthedocs.io/en/0.8.3/fields.html" rel="nofollow noreferrer">flask</a> that help us define and filter response data type,</p>
  
  <p>such as String, Integer, List and so on.</p>
  
  <p><strong>Is there any way to allow NULL / None when using fields module?</strong></p>
  
  <p>the following is my code that using field module to catch the value,</p>
  
  <pre><code>add_group = api.model(
          "add_group",
          {"team_groups": fields.List(fields.Nested(api.model("team_groups", {
              "name": fields.String(example="chicago bulls", description="name of add group"),
              "display_name": fields.String(example="bulls", description="display name of add group")})))})
  </code></pre>
  
  <p>and if the data type of <code>display_name</code> is not String, there would be the following error raised,</p>
  
  <pre><code>{
      "errors": {
          "team_groups.0.display_name": "123 is not of type 'string'"
      },
      "message": "Input payload validation failed"
  }
  </code></pre>
  
  <p><strong>what I want is when entering display_name, I can enter <code>bulls</code> or <code>None</code></strong></p>
  
  <hr>
  
  <p>It seems few of the reference data / questions can be found, and I only found <a href="https://stackoverflow.com/questions/56840335/how-to-accept-none-for-integer-type-field">one result</a> related</p>
  
  <p>to my question, but eventually converting as non-null value to solve the issue.</p>
  
  <p>if there is any part of my question not much clear,</p>
  
  <p>please let me know, thank you.</p>
  
  <p>the following is my develop environment:</p>
  
  <p><code>flask-restplus     0.13.0</code>
  <code>Python 3.7.4</code>
  <code>postman 7.18.1</code></p>
  
  <hr>
  
  <p><strong>The following is my updated code:</strong></p>
  
  <pre class="lang-py prettyprint-override"><code>from flask_restplus import Namespace, fields
  
  class NullableString(fields.String):
      __schema_type__ = ['string', 'null']
      __schema_example__ = 'nullable string'
  
  class DeviceGroupDto:
      api = Namespace("device/group", description="device groups")
      header = api.parser().add_argument("Authorization", location="headers", help="Bearer ")
  
      get_detail_group = api.model(
          "getdetail",
          {"team_groups": fields.List(fields.String(required=True,
                                                    description="team group id to get detail", example=1))})
  
      add_group = api.model(
          "add_group",
          {"team_groups": fields.List(fields.Nested(api.model("team_groups", {
              "name": fields.String(example="chicago bulls", description="name of add group"),
              "display_name": NullableString(attribute='a')})))})
  </code></pre>
  
  <p><strong>if I input the following payload: (by postman)</strong></p>
  
  <pre><code>{
      "team_groups": [
          {
              "name": "chicago bulls",
              "display_name": null
          }
      ]
  }
  </code></pre>
  
  <p><strong>It still returns:</strong></p>
  
  <pre><code>{
      "errors": {
          "team_groups.0.display_name": "None is not of type 'string'"
      },
      "message": "Input payload validation failed"
  }
  </code></pre>