diff --git a/src/aaz_dev/command/controller/workspace_cfg_editor.py b/src/aaz_dev/command/controller/workspace_cfg_editor.py index a969fac2..8775a716 100644 --- a/src/aaz_dev/command/controller/workspace_cfg_editor.py +++ b/src/aaz_dev/command/controller/workspace_cfg_editor.py @@ -218,8 +218,6 @@ def merge(self, plus_cfg_editor): arg_group = plus_cfg_editor._filter_args_in_arg_group(arg_group, new_args, copy=True) if arg_group: plus_resources_arg_groups.append(arg_group) - - if method in plus_operations_by_method: assert len(plus_operations_by_method[method]) == len(plus_cfg_editor.resources) @@ -248,6 +246,16 @@ def merge(self, plus_cfg_editor): plus_operation.http.request.header = operation.http.request.header plus_operation.http.request.body = operation.http.request.body plus_operation.http.responses = operation.http.responses + if plus_operation.http.request.method.lower() == 'get' and plus_operation.http.request.query.params: + # the get method in generate update command will ignore the optional query params if it's not exist in the put or patch operations. + # here we need to exclude them if those query params has args in the main command + params = [] + for param in plus_operation.http.request.query.params: + arg, _ = main_editor.find_arg_in_command_by_var(main_command, arg_var=param.arg) + if not param.required and not arg: + continue + params.append(param) + plus_operation.http.request.query.params = params plus_operation = plus_operation.__class__(plus_operation.to_primitive()) plus_operations.append(plus_operation) if operation_id not in plus_op_required_args: diff --git a/src/aaz_dev/command/model/configuration/_arg_builder.py b/src/aaz_dev/command/model/configuration/_arg_builder.py index cd2aaf2a..e20e592d 100644 --- a/src/aaz_dev/command/model/configuration/_arg_builder.py +++ b/src/aaz_dev/command/model/configuration/_arg_builder.py @@ -158,8 +158,11 @@ def get_sub_args(self): unwrapped_ref_arg = self._ref_arg.get_unwrapped() assert unwrapped_ref_arg is not None sub_ref_args = unwrapped_ref_arg.args - else: + # sometime this will happen for example convert from string arg or any type arg to object arg + elif hasattr(self._ref_arg, 'args'): sub_ref_args = self._ref_arg.args + else: + sub_ref_args = self._sub_ref_args else: sub_ref_args = self._sub_ref_args @@ -250,7 +253,7 @@ def get_any_type(self): def get_additional_props(self): if hasattr(self.schema, "additional_props") and self.schema.additional_props: - sub_ref_arg = self._ref_arg.additional_props if self._ref_arg else None + sub_ref_arg = self._ref_arg.additional_props if self._ref_arg and hasattr(self._ref_arg, 'additional_props') else None sub_builder = self.get_sub_builder(schema=self.schema.additional_props, ref_arg=sub_ref_arg) return sub_builder._build_arg_base() else: