From 84d3b48a3802697aaf814debb0eb6252d0a7ff6d Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 10 Dec 2025 10:23:05 +0000 Subject: [PATCH 1/4] fix bad indent --- .../pygen/codegen/templates/macros.jinja2 | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/http-client-python/generator/pygen/codegen/templates/macros.jinja2 b/packages/http-client-python/generator/pygen/codegen/templates/macros.jinja2 index 06868e5d6ab..e0033486cec 100644 --- a/packages/http-client-python/generator/pygen/codegen/templates/macros.jinja2 +++ b/packages/http-client-python/generator/pygen/codegen/templates/macros.jinja2 @@ -5,21 +5,28 @@ {% set enable_custom_handling = "\n* " in doc_string or doc_string.startswith("* ") %} {%- if enable_custom_handling -%} {%- set lines = doc_string.split('\n') -%} + {%- set base_indent = wrap_string.lstrip('\n') -%} {%- set result_lines = [] -%} {%- for line in lines -%} {%- if line.startswith('* ') -%} {# Handle bullet points with proper continuation alignment #} {%- set bullet_content = line[2:] -%} - {%- set base_indent = wrap_string.lstrip('\n') -%} {%- set bullet_line = base_indent + ' * ' + bullet_content -%} {%- set continuation_spaces = base_indent + ' ' -%} {%- set wrapped = bullet_line | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n' + continuation_spaces) -%} {%- set _ = result_lines.append(wrapped) -%} {%- elif line.strip() -%} - {%- set wrapped = line.strip() | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring=wrap_string) -%} - {%- set _ = result_lines.append(wrapped) -%} + {%- set line_indent = '' if line.strip().startswith(':') or loop.index == 1 else (base_indent + ' ') -%} + {%- set wrapped = (line_indent + line) | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring=wrap_string) -%} + {%- for line in wrapped.split('\n') -%} + {%- set prefix = "" if loop.index == 1 else " " -%} + {%- set _ = result_lines.append(prefix + line) -%} + {%- endfor -%} {%- else -%} - {%- set _ = result_lines.append('') -%} + {# Do not add continuous blank lines #} + {%- if (result_lines and result_lines[-1] != '') or not result_lines -%} + {%- set _ = result_lines.append('') -%} + {%- endif -%} {%- endif -%} {%- endfor -%} {%- set original_result = result_lines | join('\n') -%} @@ -37,4 +44,4 @@ {% set suffix = suffix_string if list_result | length == loop.index %} {{ prefix }}{{ line }}{{ suffix }} {% endfor %} -{% endmacro %} +{% endmacro %} \ No newline at end of file From 162fd1bb48c7d32993ab23c7c8ecb7cbffe7ef95 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 10 Dec 2025 10:23:39 +0000 Subject: [PATCH 2/4] update --- .../changes/python-fix-docstring-2025-11-10-10-23-28.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .chronus/changes/python-fix-docstring-2025-11-10-10-23-28.md diff --git a/.chronus/changes/python-fix-docstring-2025-11-10-10-23-28.md b/.chronus/changes/python-fix-docstring-2025-11-10-10-23-28.md new file mode 100644 index 00000000000..6abfef34bc4 --- /dev/null +++ b/.chronus/changes/python-fix-docstring-2025-11-10-10-23-28.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "@typespec/http-client-python" +--- + +Fix bad indent \ No newline at end of file From 952ef7c90c15f54e7b62d2dbef26e7a69c039fee Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 10 Dec 2025 14:00:51 +0000 Subject: [PATCH 3/4] update --- .../eng/scripts/ci/regenerate.ts | 6 +- .../generator/test/azure/requirements.txt | 1 + .../test_specs_documentation_async.py | 60 +++++++++++++++++++ .../test_specs_documentation.py | 52 ++++++++++++++++ .../generator/test/unbranded/requirements.txt | 3 +- 5 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 packages/http-client-python/generator/test/generic_mock_api_tests/asynctests/test_specs_documentation_async.py create mode 100644 packages/http-client-python/generator/test/generic_mock_api_tests/test_specs_documentation.py diff --git a/packages/http-client-python/eng/scripts/ci/regenerate.ts b/packages/http-client-python/eng/scripts/ci/regenerate.ts index 5cb3c10b843..1e435969abf 100644 --- a/packages/http-client-python/eng/scripts/ci/regenerate.ts +++ b/packages/http-client-python/eng/scripts/ci/regenerate.ts @@ -22,7 +22,7 @@ const argv = parseArgs({ }); // Add this near the top with other constants -const SKIP_SPECS = ["type/union/discriminated", "documentation"]; +const SKIP_SPECS = ["type/union/discriminated"]; // Get the directory of the current file const PLUGIN_DIR = argv.values.pluginDir @@ -272,6 +272,10 @@ const EMITTER_OPTIONS: Record | Record Date: Thu, 11 Dec 2025 02:02:42 +0000 Subject: [PATCH 4/4] fix ci --- .../generator/test/unbranded/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/http-client-python/generator/test/unbranded/requirements.txt b/packages/http-client-python/generator/test/unbranded/requirements.txt index 8bc015e9608..d788fe6b0d0 100644 --- a/packages/http-client-python/generator/test/unbranded/requirements.txt +++ b/packages/http-client-python/generator/test/unbranded/requirements.txt @@ -14,7 +14,7 @@ -e ./generated/parameters-basic -e ./generated/parameters-collection-format -e ./generated/parameters-path --e ./generated/parameters-spreadgit +-e ./generated/parameters-spread -e ./generated/serialization-encoded-name-json -e ./generated/server-endpoint-not-defined -e ./generated/server-path-multiple