Repository: microsoftgraph/msgraph-sdk-java
Issue: Properties set via AdditionalDataManager on DriveItemUploadableProperties are not serialized in the request body

Repro:

- Configure your project to use Fiddler so you can capture the request
- Use code like this:

    ```
    DriveItemUploadableProperties upProps = new DriveItemUploadableProperties();
    upProps.name = "vacation.gif";
    upProps.additionalDataManager().put("@microsoft.graph.conflictBehavior", new JsonPrimitive("rename"));

    // Create an upload session
    UploadSession uploadSession = graphClient
        .me()
        .drive()
        .root()
        // itemPath like "/Folder/file.txt"
        // does not need to be a path to an existing item
        .itemWithPath(itemPath)
        .createUploadSession(upProps)
        .buildRequest()
        .post();
    ```
- Review the request body in Fiddler

Result:

The `name` property is seralized, but not `@microsoft.graph.conflictBehavior`.

```
{"item":{"name":"vacation.gif"}}
```

Changed files:
src/test/java/com/microsoft/graph/serializer/AdditionalDataTests.java, src/main/java/com/microsoft/graph/serializer/DefaultSerializer.java

diff --git a/src/main/java/com/microsoft/graph/serializer/DefaultSerializer.java b/src/main/java/com/microsoft/graph/serializer/DefaultSerializer.java
index 7e93e795c0..822ed586b4 100644
--- a/src/main/java/com/microsoft/graph/serializer/DefaultSerializer.java
+++ b/src/main/java/com/microsoft/graph/serializer/DefaultSerializer.java
@@ -29,6 +29,9 @@ import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.microsoft.graph.logger.ILogger;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Type;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -185,23 +188,46 @@ public class DefaultSerializer implements ISerializer {
         JsonElement outJsonTree = gson.toJsonTree(serializableObject);
 
         if (serializableObject instanceof IJsonBackedObject) {
-        	IJsonBackedObject serializableJsonObject = (IJsonBackedObject) serializableObject;
-        	
-            AdditionalDataManager additionalData = serializableJsonObject.additionalDataManager();
-            
-            // If the item is a valid Graph object, add its additional data
-            if (outJsonTree.isJsonObject()) {
-                JsonObject outJson = outJsonTree.getAsJsonObject();
-                
-                addAdditionalDataToJson(additionalData, outJson);
-                outJson = getChildAdditionalData(serializableJsonObject, outJson);
-                
-                outJsonTree = outJson;
+        	outJsonTree = getDataFromAdditionalDataManager(outJsonTree, serializableObject);
+        } else if (outJsonTree.isJsonObject()) {
+            final Field[] fields = serializableObject.getClass().getDeclaredFields();
+            JsonObject outJson = outJsonTree.getAsJsonObject();
+            for(Field field : fields) {
+                if(outJson.has(field.getName())) {
+                    final Type[] interfaces = field.getType().getGenericInterfaces();
+                    for(Type interfaceType : interfaces) {
+                        if(interfaceType == IJsonBackedObject.class) {
+                            try {
+                                outJsonTree = getDataFromAdditionalDataManager(outJsonTree, field.get(serializableObject));
+                            } catch (IllegalAccessException ex ) {
+                                logger.logDebug("Couldn't access prop" + field.getName());
+                            }
+                            break;
+                        }
+                    }
+                }
             }
         }
 
         return outJsonTree.toString();
     }
+    private <T> JsonElement getDataFromAdditionalDataManager(JsonElement outJsonTree, final T serializableObject) {
+        IJsonBackedObject serializableJsonObject = (IJsonBackedObject) serializableObject;
+        	
+        AdditionalDataManager additionalData = serializableJsonObject.additionalDataManager();
+        
+        // If the item is a valid Graph object, add its additional data
+        if (outJsonTree.isJsonObject()) {
+            JsonObject outJson = outJsonTree.getAsJsonObject();
+            
+            addAdditionalDataToJson(additionalData, outJson);
+            outJson = getChildAdditionalData(serializableJsonObject, outJson);
+            
+            return outJson;
+        } else {
+            return outJsonTree;
+        }
+    }
     
     /**
      * Recursively populates additional data for each child object
diff --git a/src/test/java/com/microsoft/graph/serializer/AdditionalDataTests.java b/src/test/java/com/microsoft/graph/serializer/AdditionalDataTests.java
index 6bdce918f0..3a068d3971 100644
--- a/src/test/java/com/microsoft/graph/serializer/AdditionalDataTests.java
+++ b/src/test/java/com/microsoft/graph/serializer/AdditionalDataTests.java
@@ -13,6 +13,8 @@ import com.google.gson.JsonParser;
 import com.google.gson.JsonPrimitive;
 import com.microsoft.graph.logger.DefaultLogger;
 import com.microsoft.graph.models.extensions.Drive;
+import com.microsoft.graph.models.extensions.DriveItemCreateUploadSessionBody;
+import com.microsoft.graph.models.extensions.DriveItemUploadableProperties;
 import com.microsoft.graph.models.extensions.Entity;
 import com.microsoft.graph.models.extensions.PlannerAssignment;
 import com.microsoft.graph.models.extensions.PlannerAssignments;
@@ -55,6 +57,17 @@ public class AdditionalDataTests {
 		
 		assertEquals("{\\"manager\\":{\\"id\\":\\"1\\",\\"additionalData\\":\\"additionalValue\\"},\\"id\\":\\"2\\"}", serializedObject);
 	}
+
+	@Test 
+	public void testPropsAdditionalDataOnNonIJSONObjects() {
+		final DriveItemUploadableProperties upProps = new DriveItemUploadableProperties();
+        upProps.name = "vacation.gif";
+		upProps.additionalDataManager().put("@microsoft.graph.conflictBehavior", new JsonPrimitive("rename"));
+		final DriveItemCreateUploadSessionBody body = new DriveItemCreateUploadSessionBody();
+		body.item = upProps;
+		String serializedObject = serializer.serializeObject(body);
+		assertEquals("{\\"item\\":{\\"name\\":\\"vacation.gif\\"},\\"@microsoft.graph.conflictBehavior\\":\\"rename\\"}", serializedObject);
+	}
 	
 	@Test
 	public void testHashMapChildAnnotationData() {
@@ -93,8 +106,7 @@ public class AdditionalDataTests {
 		
 		String serialized = serializer.serializeObject(deserializedObject);
 		
-		JsonParser parser = new JsonParser();
-		JsonObject jsonObject = parser.parse(serialized).getAsJsonObject();
+		JsonObject jsonObject = JsonParser.parseString(serialized).getAsJsonObject();
 		assertNotNull(jsonObject.get("checklist").getAsJsonObject().get("1234"));
 		assertNull(jsonObject.get("checklist").getAsJsonObject().get("1234").getAsJsonObject().get("1234"));
 		assertNull(jsonObject.get("checklist").getAsJsonObject().get("1234").getAsJsonObject().get("66442"));