From 5e5ef24f641479a78610145217047d4b67bce60c Mon Sep 17 00:00:00 2001 From: aemous Date: Mon, 12 Jan 2026 17:02:44 -0500 Subject: [PATCH 1/4] Update ParamShorthand DocGen to fix the case of a structure within a map. --- awscli/argprocess.py | 6 +++++- tests/unit/test_argprocess.py | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/awscli/argprocess.py b/awscli/argprocess.py index b88ecdc7ba1b..fdc5eee8ba85 100644 --- a/awscli/argprocess.py +++ b/awscli/argprocess.py @@ -539,7 +539,11 @@ def _list_docs(self, argument_model, stack): def _map_docs(self, argument_model, stack): k = argument_model.key - value_docs = self._shorthand_docs(argument_model.value, stack) + stack.append(argument_model.value.name) + try: + value_docs = self._shorthand_docs(argument_model.value, stack) + finally: + stack.pop() start = 'KeyName1=%s,KeyName2=%s' % (value_docs, value_docs) if k.enum and not stack: start += '\n\nWhere valid key names are:\n' diff --git a/tests/unit/test_argprocess.py b/tests/unit/test_argprocess.py index 468c3a0a517c..fe5eb531f301 100644 --- a/tests/unit/test_argprocess.py +++ b/tests/unit/test_argprocess.py @@ -869,6 +869,24 @@ def test_skip_deeply_nested_shorthand(self): generated_example = self.get_generated_example_for(argument) self.assertEqual(generated_example, '') + def test_structure_within_map(self): + argument = self.create_argument( + { + 'A': { + 'type': 'map', + 'key': {'type': 'string'}, + 'value': { + 'type': 'structure', + 'members': { + 'B': {'type': 'string'}, + }, + }, + }, + } + ) + generated_example = self.get_generated_example_for(argument) + self.assertEqual('A={KeyName1={B=string},KeyName2={B=string}}', generated_example) + class TestUnpackJSONParams(BaseArgProcessTest): def setUp(self): From fe1c361bd27b6326c10a717caf1cff3d8fa212a5 Mon Sep 17 00:00:00 2001 From: aemous Date: Mon, 12 Jan 2026 19:29:47 -0500 Subject: [PATCH 2/4] Raise max-stack to 4. --- awscli/argprocess.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awscli/argprocess.py b/awscli/argprocess.py index fdc5eee8ba85..ca78c9447ea6 100644 --- a/awscli/argprocess.py +++ b/awscli/argprocess.py @@ -437,7 +437,7 @@ class ParamShorthandDocGen(ParamShorthand): """Documentation generator for param shorthand syntax.""" _DONT_DOC = object() - _MAX_STACK = 3 + _MAX_STACK = 4 def supports_shorthand(self, argument_model): """Checks if a CLI argument supports shorthand syntax.""" From 3d5e295a6cda0e08c707d89b04d9e853a836fd1d Mon Sep 17 00:00:00 2001 From: aemous Date: Tue, 13 Jan 2026 13:31:15 -0500 Subject: [PATCH 3/4] Update test for testing deeply nested shorthand. --- tests/unit/test_argprocess.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_argprocess.py b/tests/unit/test_argprocess.py index fe5eb531f301..086ed00e7ff3 100644 --- a/tests/unit/test_argprocess.py +++ b/tests/unit/test_argprocess.py @@ -857,7 +857,12 @@ def test_skip_deeply_nested_shorthand(self): 'C': { 'type': 'structure', 'members': { - 'D': {'type': 'string'}, + 'D': { + 'type': 'structure', + 'members': { + 'E': {'type': 'string'}, + }, + } }, } }, From fb7846fe049ccb88c9d7bb3fe551efda9f07fc7b Mon Sep 17 00:00:00 2001 From: aemous Date: Fri, 23 Jan 2026 10:39:36 -0500 Subject: [PATCH 4/4] Rollback change of max_stack, set value to 3. --- awscli/argprocess.py | 2 +- tests/unit/test_argprocess.py | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/awscli/argprocess.py b/awscli/argprocess.py index ca78c9447ea6..fdc5eee8ba85 100644 --- a/awscli/argprocess.py +++ b/awscli/argprocess.py @@ -437,7 +437,7 @@ class ParamShorthandDocGen(ParamShorthand): """Documentation generator for param shorthand syntax.""" _DONT_DOC = object() - _MAX_STACK = 4 + _MAX_STACK = 3 def supports_shorthand(self, argument_model): """Checks if a CLI argument supports shorthand syntax.""" diff --git a/tests/unit/test_argprocess.py b/tests/unit/test_argprocess.py index 086ed00e7ff3..fe5eb531f301 100644 --- a/tests/unit/test_argprocess.py +++ b/tests/unit/test_argprocess.py @@ -857,12 +857,7 @@ def test_skip_deeply_nested_shorthand(self): 'C': { 'type': 'structure', 'members': { - 'D': { - 'type': 'structure', - 'members': { - 'E': {'type': 'string'}, - }, - } + 'D': {'type': 'string'}, }, } },