Repository: contentful/contentful-management.py

Issue:
Updating a content type that has field's without default values causes an error
If i run: 
```python
myContentType = (
    contentful_management.Client(CONTENTFUL_MANAGEMENT_TOKEN, default_locale="en")
    .environments(CONTENTFUL_SPACE_ID)
    .find(environment)
    .content_types()
    .find("myContentType")
)
myContentType.save()
```

I get:
```
contentful_management.errors.UnprocessableEntityError: HTTP status code: 422
Message: Validation error
Details: 
	* Name: type - Path: '['fields', 0, 'defaultValue']' - Value: 'None'
```

I can get around this by getting the json value of this field, deleting the `defaultValue` field and then reapplying it. 

Discussion:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9d02b3f..0ea0b1c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,7 @@
 
 ### Changed
 * Updated `pyyaml` version to fix a vulnerability.
+* Fixed defaultValues omit instead of None for fields in content types.
 
 ## v2.14.0
 * Adds support for cross-space references
diff --git a/contentful_management/content_type_field.py b/contentful_management/content_type_field.py
index 1151daf..118c5e6 100644
--- a/contentful_management/content_type_field.py
+++ b/contentful_management/content_type_field.py
@@ -31,7 +31,8 @@ class ContentTypeField(object):
         self.omitted = field_data.get('omitted', False)
         self.required = field_data.get('required', False)
         self.disabled = field_data.get('disabled', False)
-        self.default_value = field_data.get('defaultValue', None)
+        if field_data.get('defaultValue', None) is not None:
+            self.default_value = field_data.get('defaultValue')
         self.validations = [ContentTypeFieldValidation(v)
                             for v in field_data.get('validations', [])]
         self.allowedResources = field_data.get('allowedResources')
@@ -51,9 +52,11 @@ class ContentTypeField(object):
             'required': self.required,
             'disabled': self.disabled,
             'validations': [v.to_json() for v in self.validations],
-            'defaultValue': self.default_value
         }
 
+        if hasattr(self, 'default_value'):
+            result['defaultValue'] = self.default_value
+
         if self.type == 'Array':
             result['items'] = self.items
 


Test patch:
diff --git a/tests/content_type_field_test.py b/tests/content_type_field_test.py
index c0c7383..f39e17e 100644
--- a/tests/content_type_field_test.py
+++ b/tests/content_type_field_test.py
@@ -42,6 +42,13 @@ FIELD_WITH_VALIDATIONS = {
     ]
 }
 
+FIELD_WITH_DEFAULT_VALUE = {
+    'name': 'foo',
+    'id': 'foo',
+    'type': 'Symbol',
+    'defaultValue': 'bar'
+}
+
 class ContentTypeFieldTest(TestCase):
     def test_simple_field_test(self):
         field = ContentTypeField(SIMPLE_FIELD)
@@ -56,7 +63,6 @@ class ContentTypeFieldTest(TestCase):
             'required': False,
             'disabled': False,
             'validations': [],
-            'defaultValue': None
         })
 
     def test_link_field_test(self):
@@ -73,7 +79,6 @@ class ContentTypeFieldTest(TestCase):
             'required': False,
             'disabled': False,
             'validations': [],
-            'defaultValue': None
         })
 
     def test_array_field_test(self):
@@ -91,8 +96,7 @@ class ContentTypeFieldTest(TestCase):
             'omitted': False,
             'required': False,
             'disabled': False,
-            'validations': [],
-            'defaultValue': None
+            'validations': []
         })
 
     def test_link_array_field_test(self):
@@ -112,7 +116,6 @@ class ContentTypeFieldTest(TestCase):
             'required': False,
             'disabled': False,
             'validations': [],
-            'defaultValue': None
         })
 
     def test_validations_field_test(self):
@@ -130,10 +133,25 @@ class ContentTypeFieldTest(TestCase):
             'validations': [{
                 'size': {'min': 3}
             }],
-            'defaultValue': None
         })
 
     def test_coercion(self):
         field = ContentTypeField(SIMPLE_FIELD)
 
         self.assertEqual(field.coerce(123), '123')
+
+    def test_default_value_test(self):
+        field = ContentTypeField(FIELD_WITH_DEFAULT_VALUE)
+
+        self.assertEqual(str(field), "<ContentTypeField[foo] id='foo' type='Symbol'>")
+        self.assertEqual(field.to_json(), {
+            'id': 'foo',
+            'name': 'foo',
+            'type': 'Symbol',
+            'localized': False,
+            'omitted': False,
+            'required': False,
+            'disabled': False,
+            'validations': [],
+            'defaultValue': 'bar'
+        })
diff --git a/tests/content_type_test.py b/tests/content_type_test.py
index 39fef40..4c53d74 100644
--- a/tests/content_type_test.py
+++ b/tests/content_type_test.py
@@ -62,7 +62,6 @@ class ContentTypeTest(TestCase):
                     'required': False,
                     'disabled': False,
                     'validations': [],
-                    'defaultValue': None
                 }
             ]
         })
diff --git a/tests/snapshot_test.py b/tests/snapshot_test.py
index 2bc6bf3..ca3120a 100644
--- a/tests/snapshot_test.py
+++ b/tests/snapshot_test.py
@@ -176,7 +176,6 @@ class SnapshotTest(TestCase):
                         "omitted": False,
                         "type": "Text",
                         "validations": [],
-                        "defaultValue": None
                     },
                     {
                         "id": "body",
@@ -187,7 +186,6 @@ class SnapshotTest(TestCase):
                         "omitted": False,
                         "type": "Text",
                         "validations": [],
-                        "defaultValue": None
                     }
                 ],
                 "sys": {