Fix Ruby isStream always evaluating to false in CodeMethodWriter#7639
Merged
Conversation
744b999 to
80134c4
Compare
The comparison `conventions.StreamTypeName.Equals(StringComparison.OrdinalIgnoreCase)` was passing the enum value instead of the returnType string. This caused `isStream` to always be false, meaning Ruby SDKs generated by Kiota would never use `send_primitive_async` for stream responses and always fall back to `send_async`. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
80134c4 to
de3ed06
Compare
2 tasks
hobostay
pushed a commit
to hobostay/kiota
that referenced
this pull request
Apr 23, 2026
Remove unrelated CHANGELOG entries (microsoft#7643, microsoft#7642, microsoft#7639) that don't belong to this PR. Add C# and Dart writer tests verifying that union model factory methods skip discriminator branches when the mapping key is null/empty (i.e. an unmapped complex type). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
baywet
added a commit
that referenced
this pull request
Apr 23, 2026
…generation (#7641) * Fix potential NullReferenceException in C# union model discriminator generation When no discriminator mapping is found for a property type, `FirstOrDefault` returns a default KeyValuePair with a null key. Accessing `mappedType.Key` without a null check could generate invalid C# code with empty discriminator strings. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix: discriminator null key for other languages * docs: adds changelog entries for the recent fixes * fix: badly structured code after discriminator key fix * Add regression tests for unmapped complex types in union factory methods Remove unrelated CHANGELOG entries (#7643, #7642, #7639) that don't belong to this PR. Add C# and Dart writer tests verifying that union model factory methods skip discriminator branches when the mapping key is null/empty (i.e. an unmapped complex type). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * docs: restores missing changelog entries --------- Co-authored-by: Test User <test@example.com> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com> Co-authored-by: Vincent Biret <vibiret@microsoft.com>
This was referenced Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ruby/CodeMethodWriter.cswhereconventions.StreamTypeName.Equals(StringComparison.OrdinalIgnoreCase)was passing theStringComparisonenum value instead of thereturnTypestringisStreamto always befalse, meaning Ruby SDKs generated by Kiota would never usesend_primitive_asyncfor stream/binary responsesProblem
The buggy code:
This calls
string.Equals(object, StringComparison)which compares the string"stdin"against the enum valueStringComparison.OrdinalIgnoreCase. Since a string is never equal to an enum, this always returnsfalse.Fix
Aligns with all other language writers (CSharp, Python, Dart, PHP, TypeScript) which correctly compare the return type:
Test plan
send_primitive_asyncfor stream return types🤖 Generated with Claude Code