Skip to content

[http-client-python] Refine api_version argument doc#10348

Merged
iscai-msft merged 7 commits intomainfrom
copilot/fix-api-version-doc
Apr 15, 2026
Merged

[http-client-python] Refine api_version argument doc#10348
iscai-msft merged 7 commits intomainfrom
copilot/fix-api-version-doc

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 13, 2026

  • Show None as default value for optional api_version params
  • Add "If not set, the operation's default API version will be used" note
  • Include None in known values for api_version
  • Keep "Note that overriding this default value may result in unsupported behavior" for api-version
  • Remove standalone test file per reviewer request
  • Fix condition to handle optional=False api_version params (typical case)
  • Add changeset

For optional api_version parameters:
- Known values now include "and None" since None is valid
- Default value shows None instead of the version string
- Adds note: "If not set, the operation's default API version will be used."
- Removes "Note that overriding this default value may result in unsupported behavior."

Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/0ef852ae-fc44-4ef7-9ec1-8ae7ec0e062d

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service bot added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label Apr 13, 2026
Copilot AI changed the title [WIP] Fix api_version argument documentation [http-client-python] Refine api_version argument doc Apr 13, 2026
Copilot AI requested a review from tadelesh April 13, 2026 02:25
Comment thread packages/http-client-python/generator/pygen/codegen/models/parameter.py Outdated
Comment thread packages/http-client-python/tests/unit/test_api_version_description.py Outdated
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 15, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-python@10348

commit: 917499e

@tadelesh
Copy link
Copy Markdown
Member

@copilot Recheck your implementation. I found in the regen PR, no generated code change from this change.

The api_version parameter typically has optional=False with a
client_default_value set. The previous condition (self.is_api_version
and self.optional) never triggered for this case. Changed to check
self.is_api_version regardless of optional flag, and also include
api_version in the "Known values" section.

Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/3d55c9dd-061c-409f-941c-b67ca483eefc

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 15, 2026

@copilot Recheck your implementation. I found in the regen PR, no generated code change from this change.

The issue was that my condition checked self.is_api_version and self.optional, but api_version parameters typically have optional=False with client_default_value set to the version string. The condition never triggered. Fixed in 5367a77 by changing the check to just self.is_api_version (without requiring self.optional), and also including api_version in the "Known values" section regardless of optional flag.

@tadelesh tadelesh marked this pull request as ready for review April 15, 2026 10:43
@github-actions
Copy link
Copy Markdown
Contributor

❌ There is undocummented changes. Run chronus add to add a changeset or click here.

The following packages have changes but are not documented.

  • @typespec/http-client-python
Show changes

@tadelesh
Copy link
Copy Markdown
Member

@copilot Add changeset.

Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/40a269d1-2c7a-4dfa-865d-a2757190d03c

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 15, 2026

@copilot Add changeset.

Added in 917499e.

@iscai-msft iscai-msft enabled auto-merge April 15, 2026 16:28
@iscai-msft iscai-msft added this pull request to the merge queue Apr 15, 2026
Merged via the queue into main with commit 9affc6f Apr 15, 2026
30 of 31 checks passed
@iscai-msft iscai-msft deleted the copilot/fix-api-version-doc branch April 15, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:python Issue for the Python client emitter: @typespec/http-client-python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[http-client-python] Refine api_version argument doc

3 participants