From 31133bfbd53c59576ef8dd4c46565436c9eea219 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Jul 2026 15:48:45 +0000 Subject: [PATCH 1/4] Initial plan From b8388d723da1610a82f0cb002d2986a56ac8ee0a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Jul 2026 15:53:03 +0000 Subject: [PATCH 2/4] fix: use wire names in python TypedDict docstrings Co-authored-by: l0lawrence <100643745+l0lawrence@users.noreply.github.com> --- .../codegen/serializers/model_serializer.py | 7 +++-- packages/http-client-python/package-lock.json | 4 +-- .../tests/unit/test_typeddict.py | 30 +++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/packages/http-client-python/generator/pygen/codegen/serializers/model_serializer.py b/packages/http-client-python/generator/pygen/codegen/serializers/model_serializer.py index be35a23b89e..61a4744fa56 100644 --- a/packages/http-client-python/generator/pygen/codegen/serializers/model_serializer.py +++ b/packages/http-client-python/generator/pygen/codegen/serializers/model_serializer.py @@ -77,7 +77,10 @@ def _documentation_string( prop: Property, description_keyword: str, docstring_type_keyword: str, **kwargs: Any ) -> list[str]: retval: list[str] = [] - sphinx_prefix = f":{description_keyword} {prop.client_name}:" + doc_name = ( + prop.wire_name if kwargs.get("serialize_namespace_type") == NamespaceType.TYPES_FILE else prop.client_name + ) + sphinx_prefix = f":{description_keyword} {doc_name}:" description = prop.description(is_operation_file=False).replace("\\", "\\\\") retval.append(f"{sphinx_prefix} {description}" if description else sphinx_prefix) # In the types file, use type_annotation (the serialized form) for docstrings @@ -85,7 +88,7 @@ def _documentation_string( doc_type = prop.type.type_annotation(**kwargs) else: doc_type = prop.type.docstring_type(**kwargs) - retval.append(f":{docstring_type_keyword} {prop.client_name}: {doc_type}") + retval.append(f":{docstring_type_keyword} {doc_name}: {doc_type}") return retval diff --git a/packages/http-client-python/package-lock.json b/packages/http-client-python/package-lock.json index 24fce49d063..4d314b3e2b3 100644 --- a/packages/http-client-python/package-lock.json +++ b/packages/http-client-python/package-lock.json @@ -1,12 +1,12 @@ { "name": "@typespec/http-client-python", - "version": "0.34.2", + "version": "0.35.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@typespec/http-client-python", - "version": "0.34.2", + "version": "0.35.0", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/packages/http-client-python/tests/unit/test_typeddict.py b/packages/http-client-python/tests/unit/test_typeddict.py index 3f26c2890fb..781554ebd68 100644 --- a/packages/http-client-python/tests/unit/test_typeddict.py +++ b/packages/http-client-python/tests/unit/test_typeddict.py @@ -368,6 +368,36 @@ def test_models_mode_typeddict_serialize_contains_class(): assert "TypedDict" in output +def test_models_mode_typeddict_docstring_uses_wire_name(): + """TypedDict docstrings in types.py should document the on-the-wire property name.""" + code_model = _make_code_model(models_mode="typeddict") + string_type = build_type({"type": "string"}, code_model) + model = TypedDictModelType( + yaml_data={"name": "Foo", "type": "model", "snakeCaseName": "foo", "usage": 2}, + code_model=code_model, + properties=[ + Property( + yaml_data={ + "wireName": "paramName", + "clientName": "param_name", + "optional": True, + }, + code_model=code_model, + type=string_type, + ) + ], + ) + code_model.model_types = [model] + + env = _make_env() + output = TypesSerializer(code_model=code_model, env=env, models=[model]).serialize() + + assert ":ivar paramName:" in output + assert ":vartype paramName: str" in output + assert ":ivar param_name:" not in output + assert ":vartype param_name:" not in output + + def test_types_file_has_no_named_unions(): """Serialized types.py should not contain named union definitions.""" code_model = _make_code_model(models_mode="dpg") From efd35461bdc1cde6a3d5169cab5e4775d2792a84 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Jul 2026 15:54:26 +0000 Subject: [PATCH 3/4] chore: drop unrelated python lockfile diff Co-authored-by: l0lawrence <100643745+l0lawrence@users.noreply.github.com> --- packages/http-client-python/package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/http-client-python/package-lock.json b/packages/http-client-python/package-lock.json index 4d314b3e2b3..24fce49d063 100644 --- a/packages/http-client-python/package-lock.json +++ b/packages/http-client-python/package-lock.json @@ -1,12 +1,12 @@ { "name": "@typespec/http-client-python", - "version": "0.35.0", + "version": "0.34.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@typespec/http-client-python", - "version": "0.35.0", + "version": "0.34.2", "hasInstallScript": true, "license": "MIT", "dependencies": { From e51d5919c3d18d39a0280e1441e30c5af1de6205 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Jul 2026 17:40:49 +0000 Subject: [PATCH 4/4] chore: add changelog entry for TypedDict wire names fix Co-authored-by: l0lawrence <100643745+l0lawrence@users.noreply.github.com> --- ...ix-typeddict-camelcase-docstrings-2026-6-24-17-40-35.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .chronus/changes/copilot-fix-typeddict-camelcase-docstrings-2026-6-24-17-40-35.md diff --git a/.chronus/changes/copilot-fix-typeddict-camelcase-docstrings-2026-6-24-17-40-35.md b/.chronus/changes/copilot-fix-typeddict-camelcase-docstrings-2026-6-24-17-40-35.md new file mode 100644 index 00000000000..c630f2e8060 --- /dev/null +++ b/.chronus/changes/copilot-fix-typeddict-camelcase-docstrings-2026-6-24-17-40-35.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "@typespec/http-client-python" +--- + +Use wire names in TypedDict docstrings \ No newline at end of file