Skip to content

Commit ff8289e

Browse files
committed
Added support for protocolSettings H2 optional.
1 parent 43a2270 commit ff8289e

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

generator/ServiceClientGeneratorLib/Operation.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,35 @@ public IEnumerable<Member> RequestHostPrefixMembers
525525
}
526526
}
527527

528+
/// <summary>
529+
/// Determines if any of the ResponseStructure (Output) shapes are marked with "eventstream":true.
530+
/// </summary>
528531
public bool IsEventStreamOutput => ResponseStructure?.Members?.Any(
529532
member => member.Shape?.IsEventStream ?? false)
530533
?? false;
534+
535+
/// <summary>
536+
/// Determines if any of the RequestStructure (Input) shapes are marked with "eventstream":true.
537+
/// </summary>
538+
public bool IsEventStreamInput => RequestStructure?.Members?.Any(
539+
member => member.Shape?.IsEventStream ?? false)
540+
?? false;
541+
542+
/// <summary>
543+
/// Determines if both the RequestStructure (Input) and ResponseStructure (Output) shapes contain shapes
544+
/// marked with "eventstream":true. When true, the operation is a bi-directional event stream operation
545+
/// which requires H2 support when "protocolSettings":{"h2":"eventstreams"}, "protocolSettings":{"h2":"optional"},
546+
/// or "protocolSettings":{"h2":"required"} is modeled for the service.
547+
/// </summary>
548+
public bool IsEventStreamBidi
549+
{
550+
get
551+
{
552+
return IsEventStreamInput && IsEventStreamOutput;
553+
}
554+
}
531555

556+
532557
/// <summary>
533558
/// Determines if the request structure will have members in the header
534559
/// </summary>

generator/ServiceClientGeneratorLib/ServiceModel.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,15 +442,21 @@ public List<Operation> Operations
442442
{
443443
operation = new Operation(this, kvp.Key, kvp.Value);
444444
}
445+
445446
if (operation.IsExcluded)
446447
{
447448
ExcludedOperations.Add(operation.Name);
448449
}
449-
// Event Streams are not supported (yet)
450+
// H2 event streams are not yet supported
450451
else if (H2Support == H2SupportDegree.EventStream && operation.IsEventStreamOutput)
451452
{
452453
ExcludedOperations.Add(operation.Name);
453454
}
455+
// H2 bi-directional (bidi) event streams are not yet supported
456+
else if (H2Support == H2SupportDegree.Optional && operation.IsEventStreamBidi)
457+
{
458+
ExcludedOperations.Add(operation.Name);
459+
}
454460
else
455461
{
456462
list.Add(operation);

0 commit comments

Comments
 (0)