Skip to content

Commit

Permalink
allow Initializers and NameEquals properties
Browse files Browse the repository at this point in the history
  • Loading branch information
karan-batavia committed Mar 13, 2024
1 parent 5c034b5 commit 6984dba
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions DotNetAstGen/SyntaxNodePropertiesResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal class SyntaxNodePropertiesResolver : DefaultContractResolver
"Condition", "Statement", "Statements", "Variables", "WhenNotNull", "AllowsAnyExpression", "Expressions",
"Modifiers", "ReturnType", "IsUnboundGenericName", "Default", "IsConst", "Types",
"ExplicitInterfaceSpecifier", "MetaData", "Kind", "AstRoot", "FileName", "Code", "Operand", "Block",
"Catches", "Finally", "Keyword", "Incrementors", "Sections", "Pattern", "Labels", "Elements" ,"WhenTrue", "WhenFalse"
"Catches", "Finally", "Keyword", "Incrementors", "Sections", "Pattern", "Labels", "Elements" ,"WhenTrue", "WhenFalse", "Initializers", "NameEquals"
});

private readonly List<string> _regexToAllow = new(new[]
Expand Down Expand Up @@ -55,7 +55,9 @@ protected override JsonProperty CreateProperty(MemberInfo member, MemberSerializ
{
var property = base.CreateProperty(member, memberSerialization);
var propertyName = property.PropertyName ?? "";
var shouldSerialize = propertyName != "" &&
// var shouldSerialize = propertyName != "";
var shouldSerialize = propertyName != ""
&&
(_propsToAllow.Contains(propertyName) || MatchesAllow(propertyName)) &&
!MatchesIgnore(propertyName);
Logger?.LogDebug(shouldSerialize ? $"Allowing {propertyName}" : $"Ignoring {propertyName}");
Expand Down

0 comments on commit 6984dba

Please sign in to comment.