-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat|fix: adding attribute to skip null properties
Adding the [SerializeIfNotNullAttribute] which can be applied to properties serialized by the QuerySerializer to indicate they should never be serialized when null. As a proof of concept, the RuleParameterInput used in the creation of rulesets for the repository was failing due to null properties being seralized into the final output. This code now functions as expected. I did not make a global change to no longer serialized all null values as I anticipate that there are "side effects" we depend on where there are expected null serialzations that will break if such a change is made. This is an "opt-in" feature that does not disturb the greater echosystem that may depend on these "side effects". #320
- Loading branch information
1 parent
0029dde
commit 83b7044
Showing
4 changed files
with
141 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/Octokit.GraphQL.Core/Core/Serializers/SerializeIfNotNullAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System; | ||
|
||
namespace Octokit.GraphQL.Core.Serializers | ||
{ | ||
[AttributeUsage(AttributeTargets.Property)] | ||
public class SerializeIfNotNull : Attribute | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters