Skip to content

Commit

Permalink
patch: Special case booleans (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
WamWooWam authored Dec 24, 2024
1 parent 508cb54 commit d4fc69f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tools/FFSourceGen/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public async Task GenerateAsync([Argument] string lexiconPath, string? outputDir
var directories = GetHighestLevelDirectories(dir);
foreach (var directory in directories.Where(n => !n.Contains("bsky") && !n.Contains("atproto")))
{
await this.GenerateClasses(directory);
await this.GenerateClasses(directory);
}
}

Expand Down Expand Up @@ -1178,13 +1178,28 @@ private async Task GenerateEndpointGroupAsync(IGrouping<string, ClassGeneration>
{
sb.AppendLine($" if ({prop} != null)");
sb.AppendLine(" {");
sb.AppendLine($" queryStrings.Add(\"{prop}=\" + {prop});");
if (typeName.StartsWith("bool"))
{
sb.AppendLine($" queryStrings.Add(\"{prop}=\" + ({prop}.Value ? \"true\" : \"false\"));");
}
else
{
sb.AppendLine($" queryStrings.Add(\"{prop}=\" + {prop});");
}

sb.AppendLine(" }");
sb.AppendLine();
}
else
{
sb.AppendLine($" queryStrings.Add(\"{prop}=\" + {prop});");
if (typeName.StartsWith("bool"))
{
sb.AppendLine($" queryStrings.Add(\"{prop}=\" + ({prop} ? \"true\" : \"false\"));");
}
else
{
sb.AppendLine($" queryStrings.Add(\"{prop}=\" + {prop});");
}
sb.AppendLine();
}
}
Expand Down

0 comments on commit d4fc69f

Please sign in to comment.