Add operation-aware C# body suffix linting - #5058
Draft
haiyuazhang wants to merge 9 commits into
Draft
Conversation
Add csharp-no-options-suffix, csharp-no-request-suffix, csharp-no-response-suffix, and csharp-use-standard-acronyms for C# SDK model naming. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d02f6a96-81e2-4256-b6f5-798e382049b8
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d02f6a96-81e2-4256-b6f5-798e382049b8
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d02f6a96-81e2-4256-b6f5-798e382049b8
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c0af1189-afe1-444d-9911-3e98e456f3b9
Consolidate model suffix checks, broaden augment targets, and dedent multiline code fix expectations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c0af1189-afe1-444d-9911-3e98e456f3b9
Move the new linter documentation into the source-based docs flow introduced on main. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c0af1189-afe1-444d-9911-3e98e456f3b9
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 12e46e52-385e-444f-a3fc-ee8cd7d97c83
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 12e46e52-385e-444f-a3fc-ee8cd7d97c83
Contributor
|
All changed packages have been documented.
Show changes
|
commit: |
Contributor
|
You can try these changes here
|
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
csharp-model-suffixoperation-aware for direct PATCH and PUT/POST bodiesContentfor immediate nested request models while stopping at the first named modelAddresses the design for #4447.
Detection algorithm
patchcontentcontentresponseothergetLibraryName(..., "csharp"), including any existing@clientNameoverride.Parameter,Parameters, orRequest:patchrole recommendsPatchcontentrole recommendsContent@@clientNamecode fix when the expected suffix is deterministic.The rule intentionally does not require every PATCH body name to end in
Patch; names with other suffixes remain outside #4447.Why only
Parameter,Parameters, andRequest?This boundary keeps the rule deterministic and aligned with #4447:
[Model]Patch#4447 specifically targetsParameter(s)→Patch/Content.Requestis included because batch1 normally maps it toContent, while a direct PATCH body must map it toPatch.A broader rule requiring every PATCH body name to end in
Patchwould produce approximately 653 existing diagnostics. Many affected names end inUpdate,Contract,Payload,Resource, or domain-specific terms whose correct replacement requires semantic context. For example,Settingsmay need to becomeFaceSettingsPatch, whileResourceUpdateModelmay need to becomeAgriServiceResourcePatch. The linter cannot reliably infer those service or resource prefixes.The targeted suffix list is therefore a safety boundary: it reports only cases where both the violation and recommended name are deterministic.
Dependency
This PR is stacked on #4867 because it extends the
csharp-model-suffixrule introduced there. Until #4867 merges, this PR's diff also includes the batch1 commits. After #4867 merges, the branch will be synchronized withmainso only the PATCH/Content changes remain.