Skip to content

docs: improve migration guidance for request body parameter naming (Swagger → TypeSpec)#4080

Open
Copilot wants to merge 3 commits intomainfrom
copilot/improve-migration-guidance
Open

docs: improve migration guidance for request body parameter naming (Swagger → TypeSpec)#4080
Copilot wants to merge 3 commits intomainfrom
copilot/improve-migration-guidance

Conversation

Copy link
Contributor

Copilot AI commented Mar 23, 2026

The breakingchange.md FAQ lacked guidance on when and why to rename request body parameters during Swagger migration, causing inconsistent migration decisions.

Changes to Customizing Request Payload Parameter Names

  • Breaking change callout: Explicitly states that request body parameter names affect SDK method signatures and renaming them is a client-visible breaking change.
  • Migration decision guidance: New subsection with clear fork:
    • Preserve Swagger named body parameters (via @@clientName) when SDK backward compatibility is required
    • Use standardized TypeSpec names only when a breaking change is planned or the SDK surface is new
  • Concrete migration example: One minimal example showing how to preserve the original Swagger parameter name for a createOrUpdate PUT operation:
// In your client.tsp - preserve the original Swagger parameter name to avoid a breaking change
@@clientName(Widgets.createOrUpdate::parameters.resource, "widget");
  • Keyword alignment: Section now explicitly surfaces "Swagger named body parameters", "avoid breaking changes", "SDK compatibility", "standardized request body names", and "migration decision" for discoverability (including by AI assistants).
Original prompt

This section details on the original issue you should resolve

<issue_title>Improve migration guidance for request body parameter naming from Swagger to TypeSpec</issue_title>
<issue_description>## Problem

The documentation page
Customizing Request Payload Parameter Names explains how to rename request body parameters using @@clientName, but does not explain when or why this should be done.

As a result, Teams chatbot cannot answer common migration questions such as:

“When converting from existing Swagger with named body parameters, should we keep the original parameter names to avoid a breaking change, or use standardized TypeSpec names and document the breaking change?”

This causes repeated human clarification and inconsistent migration decisions.

Actions:

  1. Add explicit decision guidance
    Clearly state:

Preserving existing names is recommended when SDK backward compatibility is required, because renaming request body parameters is a breaking change.
Using standardized TypeSpec names is acceptable only when:

a breaking change is already planned, or
the SDK surface is new.

  1. Explicitly link parameter renaming to breaking changes
    Add a paragraph stating that:

Request body parameter names affect generated SDK method signatures.
Changing them constitutes a client-visible breaking change.

  1. Add a minimal migration example
    Select one scenario and add one case, don't update all methods which make this doc complex.

  2. Improve keyword alignment
    Ensure the doc explicitly includes:

“Swagger named body parameters”
“avoid breaking changes”
“SDK compatibility”
“standardized request body names”
“migration decision”

Note: Modify this document only: https://azure.github.io/typespec-azure/docs/migrate-swagger/faq/breakingchange/ and focus on the session of #customizing-request-payload-parameter-names
All format tool should pass.

</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

… breakingchange.md

Co-authored-by: lirenhe <9100546+lirenhe@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/fde5165b-cef4-4758-9e35-f1fa7afabbde
@microsoft-github-policy-service microsoft-github-policy-service bot added the meta:website TypeSpec.io updates label Mar 23, 2026
Copilot AI changed the title [WIP] Add decision guidance for request body parameter naming docs: improve migration guidance for request body parameter naming (Swagger → TypeSpec) Mar 23, 2026
Copilot AI requested a review from lirenhe March 23, 2026 02:48
@lirenhe lirenhe marked this pull request as ready for review March 23, 2026 10:06
@lirenhe lirenhe requested a review from pshao25 March 23, 2026 10:07
- **Preserve existing names to avoid breaking changes (recommended for SDK backward compatibility):** If your SDK is already released, use `@@clientName` to keep the original Swagger named body parameters. This ensures SDK compatibility for existing consumers.
- **Use standardized TypeSpec names:** Acceptable only when a breaking change is already planned, or the SDK surface is new.

**Example:** If your Swagger defined a `createOrUpdate` operation on the `Widgets` resource interface with a body parameter named `widget` (instead of the TypeSpec default `resource`), preserve the original Swagger named body parameter to maintain SDK compatibility:
Copy link
Member

Choose a reason for hiding this comment

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

isn't exactly what each section below shows?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta:website TypeSpec.io updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve migration guidance for request body parameter naming from Swagger to TypeSpec

3 participants