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

The SDK return a List of String when it should return a List of Label [BUG]: #107

Closed
1 task done
Hossain2024 opened this issue Jul 31, 2024 · 2 comments
Closed
1 task done
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented

Comments

@Hossain2024
Copy link

Hossain2024 commented Jul 31, 2024

What happened?

I am encountering an issue while trying to get Label objects for an Issue in GitHub.

https://github.dev/octokit/dotnet-sdk/blob/main/src/GitHub/Repos/Item/Item/Issues/IssuesRequestBuilder.cs

The GitHub.Models.Issue class defines the label property as a List<string>. Based on the API response it should be a ``List```.

   public long? Id { get; set; }
        /// <summary>Labels to associate with this issue; pass one or more label names to replace the set of labels on this issue; send an empty array to clear all labels from the issue; note that the labels are silently dropped for users without push access to the repository</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
        public List<string>? Labels { get; set; }
#nullable restore
#else
        public List<string> Labels { get; set; }
#endif

The API URL:

https://api.github.com/repos/microsoft/kiota/issues/5037

"labels": [
        {
            "id": 2603543073,
            "node_id": "MDU6TGFiZWwyNjAzNTQzMDcz",
            "url": "https://api.github.com/repos/microsoft/kiota/labels/type:bug",
            "name": "type:bug",
            "color": "d73a4a",
            "default": false,
            "description": "A broken experience"
        },
        {
            "id": 3016728568,
            "node_id": "MDU6TGFiZWwzMDE2NzI4NTY4",
            "url": "https://api.github.com/repos/microsoft/kiota/labels/Python",
            "name": "Python",
            "color": "0BBE2D",
            "default": false,
            "description": ""
        }
   ]

In this API response the issues list is a List<Label>

Versions

0.0.23

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Hossain2024 Hossain2024 added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Jul 31, 2024
Copy link

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@kfcampbell
Copy link
Member

@Hossain2024 you're mixing up a request and a response there. In your first code snippet, you've quoted a comment that includes "pass one or more label names to replace the set of labels", implying a POST or a PUT request, and linked IssuesRequestBuilder.cs, which is what is sent to the API.

In the second, you've shown a list of issues from the response, what is returned from the API.

A list of strings is sent in the request to associate an issue with a given label (for which the string is the label name). A list of objects representing a label is returned in the response, for which not only the string label name is returned, but also the color, the description, the default, and various other fields.

@github-project-automation github-project-automation bot moved this from 🆕 Triage to ✅ Done in 🧰 Octokit Active Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented
Projects
Archived in project
Development

No branches or pull requests

2 participants