Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3e7122b
Add ARM use-update-for-patch lint rule
msyyc Oct 10, 2026
5d131d4
Move PATCH SDK naming guidance to TCGC common names
msyyc Oct 10, 2026
abeb615
feat(tcgc): add opt-in DELETE SDK naming rule
msyyc Oct 12, 2026
ef1e589
Address promotion review feedback
msyyc Oct 12, 2026
6475b75
Use ARM templates in DELETE naming rule documentation
msyyc Oct 13, 2026
e3785aa
Merge branch 'main' into promote-lintdiff-delete-in-operation-name
msyyc Oct 13, 2026
2af91d5
refactor(tcgc): share PATCH and PUT SDK verb-prefix checks
msyyc Oct 14, 2026
6f0eb98
refactor(tcgc): share DELETE and PUT SDK verb-prefix checks
msyyc Oct 14, 2026
5a9015b
test(tcgc): remove PATCH version and suppression-only fixtures
msyyc Oct 14, 2026
bdb8b3f
test(tcgc): remove DELETE suppression-only fixture
msyyc Oct 14, 2026
fee3ceb
Merge branch 'main' into promote-lintdiff-patch-in-operation-name
msyyc Oct 14, 2026
30ae8a4
Merge branch 'main' into promote-lintdiff-delete-in-operation-name
msyyc Oct 14, 2026
6fcf466
Share standalone ARM fixtures and isolate DELETE dependency proof
msyyc Oct 15, 2026
90e1e7d
Move native SDK linter emitter isolation to package integration tests
msyyc Oct 15, 2026
ed35661
Merge branch 'main' into promote-lintdiff-patch-in-operation-name
msyyc Oct 15, 2026
862100d
Merge branch 'main' into promote-lintdiff-delete-in-operation-name
msyyc Oct 15, 2026
380a163
Merge branch 'main' into promote-lintdiff-delete-in-operation-name
msyyc Oct 16, 2026
6b9be23
test(tcgc): simplify naming suites and package isolation
msyyc Oct 19, 2026
50c4b74
test(tcgc): simplify DELETE groups and package isolation
msyyc Oct 19, 2026
5fc361c
Merge branch 'main' into promote-lintdiff-delete-in-operation-name
msyyc Oct 19, 2026
8710828
Merge main and preserve rule inventory assertions for #5665
msyyc Oct 19, 2026
d121756
Consolidate PUT, PATCH, and DELETE SDK naming rules
msyyc Oct 20, 2026
e0ee4cd
Merge remote-tracking branch 'origin/main' into promote-lintdiff-dele…
Copilot Oct 20, 2026
a93d695
test(tcgc): remove redundant package isolation guard
msyyc Oct 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .chronus/changes/register-use-delete-for-delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- "@azure-tools/typespec-azure-rulesets"
---

Register the `@azure-tools/typespec-client-generator-core/use-delete-for-delete` lint rule as disabled in the `client-sdk` ruleset.
7 changes: 7 additions & 0 deletions .chronus/changes/use-delete-for-delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: feature
packages:
- "@azure-tools/typespec-client-generator-core"
---

Add the opt-in `use-delete-for-delete` lint rule requiring common SDK method names of concrete HTTP DELETE endpoints to start with `delete`, honoring unscoped client names and the supported friendly-name fallback.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default {
"@azure-tools/typespec-client-generator-core/csharp-model-suffix": true,
"@azure-tools/typespec-client-generator-core/use-union-hierarchy": true,
"@azure-tools/typespec-client-generator-core/get-operation-name": false,
"@azure-tools/typespec-client-generator-core/use-delete-for-delete": false,
Comment thread
msyyc marked this conversation as resolved.
Outdated
},
disable: {
"@azure-tools/typespec-client-generator-core/use-create-for-put":
Expand Down
1 change: 1 addition & 0 deletions packages/typespec-client-generator-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ Available ruleSets:
| Name | Description |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`@azure-tools/typespec-client-generator-core/use-create-for-put`](https://azure.github.io/typespec-azure/docs/libraries/typespec-client-generator-core/rules/use-create-for-put) | ARM PUT SDK method names should use 'create' as the verb prefix. |
| [`@azure-tools/typespec-client-generator-core/use-delete-for-delete`](https://azure.github.io/typespec-azure/docs/libraries/typespec-client-generator-core/rules/use-delete-for-delete) | DELETE SDK method names should use 'delete' as the verb prefix. |
| [`@azure-tools/typespec-client-generator-core/require-client-suffix`](https://azure.github.io/typespec-azure/docs/libraries/typespec-client-generator-core/rules/require-client-suffix) | Client names should end with 'Client'. |
| [`@azure-tools/typespec-client-generator-core/property-name-conflict`](https://azure.github.io/typespec-azure/docs/libraries/typespec-client-generator-core/rules/property-name-conflict) | Avoid naming conflicts between a property and a model of the same name. |
| [`@azure-tools/typespec-client-generator-core/csharp-no-url-suffix`](https://azure.github.io/typespec-azure/docs/libraries/typespec-client-generator-core/rules/csharp-no-url-suffix) | Properties ending with 'Url' should use 'Uri' suffix instead to follow .NET naming conventions. |
Expand Down
2 changes: 2 additions & 0 deletions packages/typespec-client-generator-core/src/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import { getOperationNameRule } from "./rules/get-operation-name.rule.js";
import { propertyNameConflictRule } from "./rules/property-name-conflict.rule.js";
import { requireClientSuffixRule } from "./rules/require-client-suffix.rule.js";
import { useCreateForPutRule } from "./rules/use-create-for-put.js";
import { useDeleteForDeleteRule } from "./rules/use-delete-for-delete.js";
import { useUnionHierarchyRule } from "./rules/use-union-hierarchy.js";

const rules = [
useCreateForPutRule,
useDeleteForDeleteRule,
requireClientSuffixRule,
propertyNameConflictRule,
csharpNoUrlSuffixRule,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
Use an SDK method name beginning with `delete` for HTTP DELETE operations, such as
`delete` or `deleteWidget`. Consistent names make deletion methods easier to
discover in generated clients.

The rule checks the common TCGC SDK method name case-insensitively on concrete
HTTP service endpoints. It applies to ARM and data-plane services without requiring
`@armProviderNamespace`, and is disabled by default in the `client-sdk` ruleset.
Client-only declarations that are not service endpoints are not checked.

Name resolution uses TCGC's `getLibraryName` with `AllScopes`, including an
unscoped `@clientName`, exact names, and the supported `@friendlyName` fallback.
Overrides applying only to a particular language, such as
`@clientName("remove", "csharp")`, do not replace the common name.

The source program is checked without selecting an emitter or an API-version
projection. Historical names supplied through `@renamedFrom` are not reconstructed.

The following examples use generic HTTP authoring: import `@typespec/http`, use
`TypeSpec.Http`, and place the operation in a `@service` namespace. For ARM
resources, use the standard
[resource delete operation templates](https://azure.github.io/typespec-azure/docs/howtos/ARM/resource-operations#resource-delete-operations-delete),
with a name beginning with `delete`, such as
`delete is ArmResourceDeleteSync<Widget>;`.

#### ❌ Incorrect

```typespec
@delete
@route("/widgets/{id}")
op remove(@path id: string): void;
```

#### ✅ Correct

```typespec
@delete
@route("/widgets/{id}")
op deleteWidget(@path id: string): void;
```

## Impact

- **Area:** SDK

Renaming a method in an already-shipped SDK may introduce a breaking change.
Review compatibility before changing existing names.

An unscoped `@clientName` can provide the correct SDK name without renaming the
TypeSpec operation:

```typespec
@Azure.ClientGenerator.Core.clientName("deleteWidget")
@delete
@route("/widgets/{id}")
op remove(@path id: string): void;
```

Import `@azure-tools/typespec-client-generator-core` to use `@clientName`.

## Suppression

Suppression is appropriate when preserving an already-shipped SDK method name
requires an exception approved by the API reviewer. For new methods, fix the
name instead, either by renaming the operation or using an unscoped `@clientName`.
Use `#suppress "@azure-tools/typespec-client-generator-core/use-delete-for-delete"`
on the operation with a justification for the compatibility exception.
Comment thread
msyyc marked this conversation as resolved.
Outdated

## LintDiff Equivalent

This rule enforces the SDK naming intent of
[`DeleteInOperationName`](https://github.com/Azure/azure-openapi-validator/blob/main/docs/delete-in-operation-name.md).
It does not reproduce serialized `operationId` underscore or group-prefix
exemptions. Explicit OpenAPI operation IDs do not change the common SDK method
name checked by this rule. The lintdiff source checks authored operation names;
the promoted rule intentionally checks common SDK names, including unscoped
SDK name overrides.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { createRule, fileRef, paramMessage } from "@typespec/compiler";
import { getAllHttpServices } from "@typespec/http";
import { createTCGCContext } from "../context.js";
import { AllScopes } from "../internal-utils.js";
import { getLibraryName } from "../public-utils.js";

export const useDeleteForDeleteRule = createRule({
name: "use-delete-for-delete",
description: "DELETE SDK method names should use 'delete' as the verb prefix.",
severity: "warning",
url: "https://azure.github.io/typespec-azure/docs/libraries/typespec-client-generator-core/rules/use-delete-for-delete",
docs: fileRef.fromPackageRoot("src/rules/use-delete-for-delete.md"),
messages: {
default: paramMessage`DELETE SDK method name '${"operationName"}' should start with 'delete'.`,
},
create(context) {
const tcgcContext = createTCGCContext(
context.program,
"@azure-tools/typespec-client-generator-core",
{ mutateNamespace: false },
);

return {
root: () => {
const [services] = getAllHttpServices(context.program);
for (const service of services) {
for (const { operation, verb } of service.operations) {
if (verb !== "delete") {
continue;
}

const operationName = getLibraryName(tcgcContext, operation, AllScopes);
if (operationName.toLowerCase().startsWith("delete")) {
continue;
}

context.reportDiagnostic({
target: operation,
format: { operationName },
});
}
}
},
};
},
});
Loading
Loading