Skip to content

Commit

Permalink
fix: Improve query parameter transcoding
Browse files Browse the repository at this point in the history
This still isn't entirely complete, but:

- Required fields are included even if they're set to the default value
- Repeated fields are included appropriately

I'll refactor this before handling nested messages appearing as query parameters.

This fixes the Compute integration tests.
  • Loading branch information
jskeet committed Jul 22, 2022
1 parent 473e23f commit b747591
Show file tree
Hide file tree
Showing 6 changed files with 839 additions and 25 deletions.
1 change: 1 addition & 0 deletions Google.Api.Gax.Grpc.Tests/Google.Api.Gax.Grpc.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="Grpc.Core" Version="[2.46.3, 3.0.0)" />
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 8 additions & 1 deletion Google.Api.Gax.Grpc.Tests/Rest/HttpRuleTranscoderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ namespace Google.Api.Gax.Grpc.Rest.Tests;

public class HttpRuleTranscoderTest
{
private static readonly List<string> SkippedTranscodingTests = new()
{
"ComplexQuery_Nested"
};

private static TestFile s_testFile = LoadTestFile();
public static IEnumerable<object[]> Tests => s_testFile.Tests
.Select(t => new object[] { new SerializableTest(t) });
Expand All @@ -34,11 +39,13 @@ private static TestFile LoadTestFile()
return TestFile.Parser.ParseJson(json);
}

[Theory]
[SkippableTheory]
[MemberData(nameof(Tests))]
public void Transcode(SerializableTest testWrapper)
{
var test = testWrapper.Test;
Skip.If(SkippedTranscodingTests.Contains(test.Name));

var rule = test.RuleCase switch
{
RuleOneofCase.InlineRule => test.InlineRule,
Expand Down

0 comments on commit b747591

Please sign in to comment.