Skip to content

Commit

Permalink
generate sdks that are models only (#2633)
Browse files Browse the repository at this point in the history
  • Loading branch information
iscai-msft authored Jun 12, 2024
1 parent 91c1c0b commit b6c5aaf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .chronus/changes/fix_models_only-2024-5-11-21-50-18.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@autorest/python"
---

generate sdks without operations
2 changes: 1 addition & 1 deletion packages/autorest.python/autorest/codegen/models/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def add_og_request_builder(og: Dict[str, Any]):
)
)

queue = self.yaml_data["operationGroups"].copy()
queue = self.yaml_data.get("operationGroups", []).copy()
while queue:
now = queue.pop(0)
add_og_request_builder(now)
Expand Down
4 changes: 2 additions & 2 deletions packages/autorest.python/autorest/preprocess/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def update_client(self, yaml_data: Dict[str, Any]) -> None:
if prop_name.endswith("Client"):
prop_name = prop_name[: len(prop_name) - len("Client")]
yaml_data["builderPadName"] = to_snake_case(prop_name)
for og in yaml_data["operationGroups"]:
for og in yaml_data.get("operationGroups", []):
for o in og["operations"]:
property_if_match = None
property_if_none_match = None
Expand Down Expand Up @@ -449,7 +449,7 @@ def update_paging_operation(
self.update_paging_operation(code_model, overload, is_overload=True, item_type=item_type)

def update_operation_groups(self, code_model: Dict[str, Any], client: Dict[str, Any]) -> None:
operation_groups_yaml_data = client["operationGroups"]
operation_groups_yaml_data = client.get("operationGroups", [])
for operation_group in operation_groups_yaml_data:
operation_group["identifyName"] = self.pad_reserved_words(
operation_group.get("name", operation_group["propertyName"]),
Expand Down

0 comments on commit b6c5aaf

Please sign in to comment.