Skip to content

Commit

Permalink
don't lowercase serialized body entries (#2608)
Browse files Browse the repository at this point in the history
  • Loading branch information
iscai-msft committed May 31, 2024
1 parent 8a37852 commit 1c66198
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .chronus/changes/fix_body_root-2024-4-31-12-40-38.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: fix
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---

don't lowercase serialized names when building a body from splatted arguments
6 changes: 3 additions & 3 deletions packages/autorest.python/autorest/preprocess/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,9 @@ def update_parameter(self, yaml_data: Dict[str, Any]) -> None:
if yaml_data.get("propertyToParameterName"):
# need to create a new one with padded keys and values
yaml_data["propertyToParameterName"] = {
self.pad_reserved_words(prop, PadType.PROPERTY)
.lower(): self.pad_reserved_words(param_name, PadType.PARAMETER)
.lower()
self.pad_reserved_words(prop, PadType.PROPERTY): self.pad_reserved_words(
param_name, PadType.PARAMETER
).lower()
for prop, param_name in yaml_data["propertyToParameterName"].items()
}
wire_name_lower = (yaml_data.get("wireName") or "").lower()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ async def anonymous_model( # pylint: disable=inconsistent-return-statements
if body is _Unset:
if profile_image is _Unset:
raise TypeError("missing required argument: profile_image")
body = {"profileimage": profile_image}
body = {"profileImage": profile_image}
body = {k: v for k, v in body.items() if v is not None}
_body = body.as_dict() if isinstance(body, _model_base.Model) else body
_file_fields: List[str] = ["profileImage"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ def anonymous_model( # pylint: disable=inconsistent-return-statements
if body is _Unset:
if profile_image is _Unset:
raise TypeError("missing required argument: profile_image")
body = {"profileimage": profile_image}
body = {"profileImage": profile_image}
body = {k: v for k, v in body.items() if v is not None}
_body = body.as_dict() if isinstance(body, _model_base.Model) else body
_file_fields: List[str] = ["profileImage"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ async def anonymous_model( # pylint: disable=inconsistent-return-statements
if body is _Unset:
if profile_image is _Unset:
raise TypeError("missing required argument: profile_image")
body = {"profileimage": profile_image}
body = {"profileImage": profile_image}
body = {k: v for k, v in body.items() if v is not None}
_body = body.as_dict() if isinstance(body, _model_base.Model) else body
_file_fields: List[str] = ["profileImage"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ def anonymous_model( # pylint: disable=inconsistent-return-statements
if body is _Unset:
if profile_image is _Unset:
raise TypeError("missing required argument: profile_image")
body = {"profileimage": profile_image}
body = {"profileImage": profile_image}
body = {k: v for k, v in body.items() if v is not None}
_body = body.as_dict() if isinstance(body, _model_base.Model) else body
_file_fields: List[str] = ["profileImage"]
Expand Down

0 comments on commit 1c66198

Please sign in to comment.