Skip to content

Commit be99cad

Browse files
iscai-msftiscai-msft
andauthored
[python] fix incorrect padding of wire key name in splatted body method signature (#10326)
fixes #10247 Co-authored-by: iscai-msft <isabellavcai@gmail.com>
1 parent 755fe9a commit be99cad

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind: fix
3+
packages:
4+
- "@typespec/http-client-python"
5+
---
6+
7+
Fix padding of keys in splatted body parameter method signature

packages/http-client-python/generator/pygen/preprocess/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,9 @@ def update_parameter(self, yaml_data: dict[str, Any]) -> None:
362362
yaml_data["clientName"].lower(), PadType.PARAMETER, yaml_data
363363
)
364364
if yaml_data.get("propertyToParameterName"):
365-
# need to create a new one with padded keys and values
365+
# need to create a new one with padded values (but NOT keys, since keys are wire names)
366366
yaml_data["propertyToParameterName"] = {
367-
self.pad_reserved_words(prop, PadType.PROPERTY, yaml_data): self.pad_reserved_words(
368-
param_name, PadType.PARAMETER, yaml_data
369-
).lower()
367+
prop: self.pad_reserved_words(param_name, PadType.PARAMETER, yaml_data).lower()
370368
for prop, param_name in yaml_data["propertyToParameterName"].items()
371369
}
372370
wire_name_lower = (yaml_data.get("wireName") or "").lower()

0 commit comments

Comments
 (0)