Two docstrings in openapi_tool document parameters the signatures do not accept

未關閉 適合新手
#8,024 1 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

維護者通常 3 天內回覆

@surajksharma07 已經在處理了。

開始於 2026年11月9日。

  • #8026 來自 @Anoshor —— 未關閉

評估

難度
1/5
預估耗時
1 小時以內
新手友好度
88/100
Issue 類型
文件
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python
領域
documentation

研究方向

閱讀 src/google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py:352 和 src/google/adk/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.py:69 中的 docstring,並對照相應的方法簽章。更新第一處,將 parsed_operation_str 描述為 JSON 字串,並從第二處刪除不存在的引數 auth_scheme。當兩個 Args 區段都與其簽章和型別一致時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

Two docstrings in google/adk document parameters that the signatures do not accept

Both are in the OpenAPI tooling under src/google/adk/tools/openapi_tool/. Neither affects behaviour; both mislead anyone reading the reference for the tool-building path.

1. RestApiTool.from_parsed_operation_str — wrong name and wrong type

src/google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py:352

    @classmethod
    def from_parsed_operation_str(
        cls, parsed_operation_str: str
    ) -> "RestApiTool":
        """Initializes the RestApiTool from a dict.

        Args:
            parsed: A dict representation of a ParsedOperation object.
        ...
        operation = ParsedOperation.model_validate_json(parsed_operation_str)

The parameter is parsed_operation_str, and it is a JSON string (model_validate_json), not a dict. Both halves of the sentence are stale: the name and the type.

2. OAuth2CredentialExchanger.generate_auth_token — documents a parameter that is not there

src/google/adk/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.py:69

    def generate_auth_token(
        self,
        auth_credential: Optional[AuthCredential] = None,
    ) -> AuthCredential:
        """Generates an auth token from the authorization response.

        Args:
            auth_scheme: The OpenID Connect or OAuth2 auth scheme.
            auth_credential: The auth credential.

auth_scheme is not a parameter of this method (the scheme was consumed by AuthCredential earlier in the flow). auth_credential is.

Suggested diff

--- a/src/google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py
+++ b/src/google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py
@@
-        """Initializes the RestApiTool from a dict.
+        """Initializes the RestApiTool from a serialized ParsedOperation.
 
         Args:
-            parsed: A dict representation of a ParsedOperation object.
+            parsed_operation_str: A JSON string representation of a ParsedOperation object.
--- a/src/google/adk/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.py
+++ b/src/google/adk/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.py
@@
         Args:
-            auth_scheme: The OpenID Connect or OAuth2 auth scheme.
             auth_credential: The auth credential.

How this was found

A static check over Google-style Args: blocks that reports entries whose name is not an argument of the enclosing function; the two rows above were then read against the signatures by hand. A repo-wide run also flagged application_integration_toolset.py and the _execute_sql_* helpers in the BigQuery integration, but those are **kwargs forwarding and a nested-section parse, i.e. not defects, so they are excluded here.

Why an issue and not a PR

CONTRIBUTING.md requires a signed Google CLA before a PR, and the google-cla check fails for this account (confirmed on a separate Google repository — google/XNNPACK#11910 shows cla/google failing until the agreement is signed). If you would rather have the patch directly, I can open the PR as soon as the CLA is signed on my side; otherwise this report is everything needed for the two-line fix.

主要語言
Python
星號
22.3k
分支
4.4k
平均合併
1 天 2 小時
30 天內合併 PR
6

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

google/adk-python 的其他 Issue

查看 google/adk-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。