Skip to content

Commit

Permalink
fix: Skip streaming methods during REST method discovery
Browse files Browse the repository at this point in the history
This avoids even trying to create RestMethod instances for methods we don't support
  • Loading branch information
jskeet committed Sep 6, 2022
1 parent 8b40dcd commit ad85def
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Google.Api.Gax.Grpc/Rest/RestServiceCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ internal static RestServiceCollection Create(ApiMetadata metadata)
var typeRegistry = TypeRegistry.FromFiles(fileDescriptors.ToArray());
var parser = new JsonParser(JsonParser.Settings.Default.WithIgnoreUnknownFields(true).WithTypeRegistry(typeRegistry));
var methodsByName = services.SelectMany(service => service.Methods)
.Where(x => true) // TODO: filter out streaming methods.
// We don't yet support streaming methods.
.Where(x => !x.IsClientStreaming && !x.IsServerStreaming)
.Select(method => RestMethod.Create(metadata, method, parser))
.ToDictionary(restMethod => restMethod.FullName);
return new RestServiceCollection(new ReadOnlyDictionary<string, RestMethod>(methodsByName));
Expand Down

0 comments on commit ad85def

Please sign in to comment.