mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-21 14:45:11 +00:00
use opt-in attributes to indicate when a null property should be sent
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user