From 851fd6c37cf5d12020e61d43773d742512f88833 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Mon, 23 Dec 2024 10:32:35 +0800 Subject: [PATCH] fix crash when no og in client --- .../http-client-python/generator/pygen/codegen/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/http-client-python/generator/pygen/codegen/__init__.py b/packages/http-client-python/generator/pygen/codegen/__init__.py index 074b5854c8..ce8368d417 100644 --- a/packages/http-client-python/generator/pygen/codegen/__init__.py +++ b/packages/http-client-python/generator/pygen/codegen/__init__.py @@ -245,7 +245,7 @@ def _validate_code_model_options(self) -> None: @staticmethod def sort_exceptions(yaml_data: Dict[str, Any]) -> None: for client in yaml_data["clients"]: - for group in client["operationGroups"]: + for group in client.get("operationGroups", []): for operation in group["operations"]: if not operation.get("exceptions"): continue @@ -262,7 +262,7 @@ def sort_exceptions(yaml_data: Dict[str, Any]) -> None: @staticmethod def remove_cloud_errors(yaml_data: Dict[str, Any]) -> None: for client in yaml_data["clients"]: - for group in client["operationGroups"]: + for group in client.get("operationGroups", []): for operation in group["operations"]: if not operation.get("exceptions"): continue