Skip to content

Fix incorrect command hints and telemetry in plugin generate handler#7642

Merged
baywet merged 1 commit intomicrosoft:mainfrom
hobostay:fix/plugin-generate-wrong-hint
Apr 21, 2026
Merged

Fix incorrect command hints and telemetry in plugin generate handler#7642
baywet merged 1 commit intomicrosoft:mainfrom
hobostay:fix/plugin-generate-wrong-hint

Conversation

@hobostay
Copy link
Copy Markdown
Contributor

Summary

  • Fix DisplayCleanHint showing "client generate" instead of "plugin generate" when an update is skipped
  • Fix error message saying "No client found" instead of "No plugin found" when a named plugin doesn't exist
  • Fix telemetry tag using client_name instead of plugin_name, causing plugin operations to be miscategorized in telemetry

Problem

The plugin generate handler (Handlers/Plugin/GenerateHandler.cs) was copy-pasted from the client generate handler without updating all references. Three places incorrectly referenced "client" instead of "plugin":

  1. Line 105: DisplayCleanHint("client generate", "--refresh") — users see "kiota client generate --refresh" instead of "kiota plugin generate --refresh"
  2. Line 76: "No client found with the provided name" — misleading when working with plugins
  3. Line 140: Telemetry tag .client_name — plugin operations miscategorized as client operations

Test plan

  • Run kiota plugin generate with a non-existent name, verify error message says "plugin"
  • Run kiota plugin generate with --refresh on an unchanged plugin, verify hint says "plugin generate"

🤖 Generated with Claude Code

@hobostay hobostay requested a review from a team as a code owner April 21, 2026 12:16
Copy link
Copy Markdown
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

- Change DisplayCleanHint from "client generate" to "plugin generate" so users see the correct command suggestion
- Fix error message from "No client found" to "No plugin found"
- Fix telemetry tag from "client_name" to "plugin_name" for correct telemetry categorization

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@baywet baywet force-pushed the fix/plugin-generate-wrong-hint branch from 1fd1bda to c222bd5 Compare April 21, 2026 16:59
@baywet baywet enabled auto-merge (squash) April 21, 2026 16:59
@baywet baywet merged commit 4946bb3 into microsoft:main Apr 21, 2026
297 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants