fix(python): Fix duplicate model docstrings on regeneration#11289
fix(python): Fix duplicate model docstrings on regeneration#11289JennyPng wants to merge 4 commits into
Conversation
…s pylint suppressions Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 703c4fd4-5e78-4f26-b389-f4d336687010
commit: |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 703c4fd4-5e78-4f26-b389-f4d336687010
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
…string fix The previous commit removed docstring-missing-param suppressions on passthrough operations classes and passthrough-only models based on a tainted local 0.5.9 checker that (incorrectly) exempted (*args, **kwargs) constructors. The real 0.5.9 used by integration CI still requires those suppressions, so restore them. The only net change from the base commit is now: remove the duplicate :keyword:/:paramtype: docstring lines on DPG models and silence docstring-keyword-should-match-keyword-only instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 703c4fd4-5e78-4f26-b389-f4d336687010
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 703c4fd4-5e78-4f26-b389-f4d336687010
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue in the Python DPG model generator where regenerated models could end up with duplicated docstring entries (duplicate :keyword:/:paramtype: lines alongside existing :ivar:/:vartype: lines). It removes the redundant keyword-doc generation path and instead suppresses the docstring-keyword-should-match-keyword-only guideline check at the DPG model class declaration line, matching how the guideline checker evaluates empty @overload __init__ bodies.
Changes:
- Remove rendering of keyword-only
:keyword:/:paramtype:docstring lines for DPG models to avoid duplication. - Remove the unused
keyword_documentation_stringserializer helper (verified no remaining references inpygen/). - Add a DPG-specific
class_pylint_disableoverride to silencedocstring-keyword-should-match-keyword-onlywhen the model has generated keyword-only init parameters.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/http-client-python/generator/pygen/codegen/templates/model_dpg.py.jinja2 | Stops emitting per-property :keyword:/:paramtype: lines into the class docstring for DPG models. |
| packages/http-client-python/generator/pygen/codegen/serializers/model_serializer.py | Removes the now-unused keyword-doc helper and adds a DPG class-level pylint disable for the guideline checker rule. |
| .chronus/changes/python-docstring-duplicate-fix-2026-7-16-22-38-0.md | Adds a fix changelog entry for the docstring duplication issue in @typespec/http-client-python. |
Follow-up fix to #11197 (pylint-guidelines-checker
0.5.9bump). On regeneration, DPG models emitted a duplicate docstring::keyword:/:paramtype:lines in the class docstring duplicated the existing:ivar:/:vartype:entries (e.g.InvalidAuth).Changes
docstring-keyword-should-match-keyword-onlyat the class line instead — DPG__init__overloads have empty bodies, so the checker validates keyword-only args against the class docstring, and we intentionally document those args once as:ivar:entries.Validation
todo
no-cross-package-private-importin pylintrc oftypespec-azure