use opt-in attributes to indicate when a null property should be sent

This commit is contained in:
Brendan Forster
2014-07-08 09:34:12 +09:30
parent b45bf4219f
commit 2e47369b9b
8 changed files with 31 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Octokit.Reflection;
namespace Octokit.Internal
@@ -43,8 +44,23 @@ namespace Octokit.Internal
{
var value = getter.Value(input);
if (value == null)
{
continue;
// sometimes Octokit needs to send a null
// so look for this attribute when serializing
// XXX: we don't know which property we have at this point
// so this reflection trick doesn't work
// TODO: make this magic work
//var property = type.GetProperty(getter.Key);
//var attribute = property.GetCustomAttribute<SerializeNullAttribute>();
//if (attribute == null)
//{
// continue;
//}
}
jsonObject.Add(MapClrMemberNameToJsonFieldName(getter.Key), value);
}
}