Two docstrings in openapi_tool document parameters the signatures do not accept

Ouverte Adaptée aux débutants
#8,024 1 commentaire 0 réactions 1 personne assignée Voir sur GitHub

Les mainteneurs répondent en général sous 3 jours

@surajksharma07 y travaille déjà.

Depuis le 9/11/2026.

  • #8026 par @Anoshor — ouverte

Évaluation

Difficulté
1/5
Temps estimé
Moins d'une heure
Accessibilité débutants
88/100
Type d'issue
Documentation
Clarté
Clairement spécifiée
Activité
Active
Stack technique
python
Domaine
documentation

Piste de recherche

Lis les docstrings dans src/google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py:352 et src/google/adk/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.py:69 en parallèle des signatures de leurs méthodes. Modifie le premier pour décrire parsed_operation_str comme une chaîne JSON et supprime l’argument inexistant auth_scheme du second. Le travail est terminé lorsque les deux sections Args correspondent à leurs signatures et à leurs types.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Python
Étoiles
22.3k
Forks
4.4k
Merge moyen
1 j 2 h
PR mergées (30 j)
6

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de google/adk-python

Toutes les issues de google/adk-python

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.