Skip to content

python-jenkins stubs: get_jobs() and get_all_jobs() functions annotations are wrong #14538

@roberfi

Description

@roberfi

Type annotation for methods get_jobs() and get_all_jobs() is list[dict[str, str]]. However, the dictionaries of the returned list contain not only str typed values but also the nested jobs. For example:

[
  {
    "_class": "com.cloudbees.hudson.plugins.folder.Folder",
    "name": "job1",
    "url": "https://example.com/job/job1/",
    "jobs": [
      {
        "_class": "com.cloudbees.hudson.plugins.folder.Folder",
        "name": "job2",
        "url": "https://example.com/job/job1/job/job2/",
        "jobs": [
          {
            "_class": "org.jenkinsci.plugins.workflow.job.WorkflowJob",
            "name": "job3",
            "url": "https://example.com/job/job1/job/job2/job/job3/"
            "color": "red"
          }
        ]
      }
    ]
  }
]

So, I propose that those methods are annotated with list[_JSON].

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions