tsp-naming-collision

Identify Java codegen parameter collisions and apply @@clientName overrides in TypeSpec.

2.6k|2.2k|Updated Dec 6, 2011
One-click install
npx skills add https://github.com/Azure/azure-sdk-for-java --skill tsp-naming-collision
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tsp-naming-collision
Source: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/ai/.workflow_docs/tsp-naming-collision
Command: npx skills add https://github.com/Azure/azure-sdk-for-java --skill tsp-naming-collision

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and scripts (resource) components.

What problem does it solve?

This Skill resolves issues where generated Java client methods have parameter names ending in '1' due to TypeSpec model name collisions.

Core Features & Use Cases

  • Identify Collisions: Helps pinpoint generated Java client parameters and implementation models with a '1' suffix.
  • Trace to TypeSpec: Guides users to find the specific TypeSpec models causing these naming conflicts.
  • Apply Fixes: Enables the use of @@clientName directives in TypeSpec to rename models and prevent collisions.
  • Use Case: When your generated Java SDK for an AI service has methods like createAgentRequest1, this skill helps you fix that by adjusting the underlying TypeSpec definitions.

Quick Start

Use the tsp-naming-collision skill to fix Java codegen parameter names that end with a numeric suffix.

Frequently Asked Questions about tsp-naming-collision

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my generated Java SDK have method parameter names ending in '1'?

Java codegen appends a '1' suffix to parameter names when TypeSpec model names clash with synthetic body types. This naming collision occurs because the generator disambiguates conflicting names automatically during client generation.

How do I fix Java codegen naming collisions using TypeSpec definitions?

To fix Java codegen naming collisions, apply `@@clientName` directives in your TypeSpec definitions to rename the colliding models. Regenerate the Java client using the `tsp-client` tool to produce clean parameter names without suffixes.

What is the best way to trace a '1' suffix in generated Java client methods back to TypeSpec?

Trace the '1' suffix by identifying the generated Java client method and its implementation model, then locate the specific TypeSpec model causing the naming conflict. The collision happens when a model name matches a synthetic body type name.

Do I need local TypeSpec files and the tsp-client tool to resolve parameter naming collisions?

Yes, resolving naming collisions requires local TypeSpec files to apply `@@clientName` overrides and the `tsp-client` tool to regenerate the Java SDK. These are necessary to rename colliding models and produce updated client code.

Can I use @@clientName in TypeSpec to rename models that clash with synthetic body types?

Yes, `@@clientName` in TypeSpec is the directive used to rename models clashing with synthetic body types. Applying it to the colliding model prevents the Java codegen from generating parameter names with a '1' suffix.

TypeSpec model name collisions not working when regenerating Java SDK, what are the limitations?

A limitation is that fixing collisions requires manual identification of which TypeSpec models clash with synthetic body types. You must correctly apply `@@clientName` directives and rerun the `tsp-client` tool; otherwise, the '1' suffix persists in generated Java methods.