Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projects: Unused Public field #1478

Closed
amitsaha opened this issue May 20, 2022 · 3 comments · Fixed by #1934
Closed

Projects: Unused Public field #1478

amitsaha opened this issue May 20, 2022 · 3 comments · Fixed by #1934

Comments

@amitsaha
Copy link
Contributor

I believe

Public bool `json:"public"`
is not being set correctly, likely because there is no public field in the JSON response any more? Hence, it is always false for all projects, irrespective of their visibility.

To reproduce:

  1. Create a test private project
  2. Create a test public project

Run:

package main

import (
    "log"
    "os"

    "[github.com/xanzy/go-gitlab](http://github.com/xanzy/go-gitlab)"
)

func main() {
    git, err := gitlab.NewClient(os.Getenv("GITLAB_TOKEN"))
    if err != nil {
        log.Fatal(err)
    }

    opts := gitlab.ListProjectsOptions{
        Owned: gitlab.Bool(true),
    }

    projects, _, err := git.Projects.ListProjects(&opts)
    if err != nil {
        log.Fatal(err)
    }
    for _, p := range projects {
        log.Printf("%v -> visibility: %v -> public: %v\n",
p.PathWithNamespace, p.Visibility, p.Public)
    }
}

You will see Public is always false. Happy to create a PR as well.

@svanharmelen
Copy link
Member

Guess a quick check with the docs or GitLab codebase would be good... And also make sure it's not used in older versions (as we still like to be able to support those as well).

@heidiberry
Copy link
Contributor

This field was present in the first release of this repo in 2015. Looking through the GitLab codebase, it was removed from the API in this merge request back in 2017 https://gitlab.com/gitlab-org/gitlab/-/merge_requests/1267/diffs which was around version 9.0 of GitLab.

@svanharmelen
Copy link
Member

In that case I guess it's save to remove it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants