diff options
| author | John L. Villalovos <john@sodarock.com> | 2022-10-05 07:43:14 -0700 |
|---|---|---|
| committer | Nejc Habjan <hab.nejc@gmail.com> | 2022-10-06 09:24:02 +0200 |
| commit | 9b88132078ed37417c2a45369b4976c9c67f7882 (patch) | |
| tree | 61f075c8d2685df36153970f2a93937ac9f14c86 /gitlab/v4/cli.py | |
| parent | c15bd33f45fbd9d064f1e173c6b3ca1b216def2f (diff) | |
| download | gitlab-9b88132078ed37417c2a45369b4976c9c67f7882.tar.gz | |
fix(cli): handle list response for json/yaml output
Handle the case with the CLI where a list response is returned from
GitLab and json/yaml output is requested.
Add a functional CLI test to validate it works.
Closes: #2287
Diffstat (limited to 'gitlab/v4/cli.py')
| -rw-r--r-- | gitlab/v4/cli.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py index a4f4e2c..1a6ea39 100644 --- a/gitlab/v4/cli.py +++ b/gitlab/v4/cli.py @@ -387,9 +387,9 @@ def extend_parser(parser: argparse.ArgumentParser) -> argparse.ArgumentParser: def get_dict( - obj: Union[str, gitlab.base.RESTObject], fields: List[str] + obj: Union[str, Dict[str, Any], gitlab.base.RESTObject], fields: List[str] ) -> Union[str, Dict[str, Any]]: - if isinstance(obj, str): + if not isinstance(obj, gitlab.base.RESTObject): return obj if fields: @@ -406,7 +406,7 @@ class JSONPrinter: @staticmethod def display_list( - data: List[Union[str, gitlab.base.RESTObject]], + data: List[Union[str, Dict[str, Any], gitlab.base.RESTObject]], fields: List[str], **_kwargs: Any, ) -> None: @@ -431,7 +431,7 @@ class YAMLPrinter: @staticmethod def display_list( - data: List[Union[str, gitlab.base.RESTObject]], + data: List[Union[str, Dict[str, Any], gitlab.base.RESTObject]], fields: List[str], **_kwargs: Any, ) -> None: |
