jdalrymple / gitbeaker

🦊🧪 A comprehensive and typed Gitlab SDK for Node.js, Browsers, Deno and CLI
Other
1.5k stars 283 forks source link

shared_with_groups returns different types for Groups and Projects #3579

Closed Rein142 closed 1 month ago

Rein142 commented 2 months ago

Description I am trying to implement a function in React (typescript) that compares the properties of shared_with_groups on a Group or Project with ones that a user wants to add to said resource. But I am running into the fact that on Groups, calling on the shared_with_groups attribute, gitbeaker returns this as a ProjectSchema array, whereas on Projects it returns this as a string array. Is this an intended feature? I don't see how the following output makes sense in a ProjectSchema:

"shared_with_groups": [
  {
    "group_id": <id>,
    "group_name": "<name>",
    "group_full_path": "<path>",
    "group_access_level": <access_level>,
    "expires_at": <expiration_date>
  }
]

Can someone tell me whether this is intended or not, and if it is, why exactly?

I call upon these properties like this:

const groupInfo = await this.gitlabApi.api.Groups.show(<group_id>)
const groupSharedWithGroups = groupInfo.shared_with_groups

const projectInfo = await this.gitlabApi.api.Projects.show(<project_id>)
const projectSharedWithGroups = projectInfo.shared_with_groups

Checklist

jdalrymple commented 2 months ago

Sounds like a typo, but ill double check it and follow up

Rein142 commented 2 months ago

Looking at the fix it changed the string array return type for the ProjectSchema, but within the ExpandedGroupSchema it still returns a ProjectSchema array, is this intended then?

jdalrymple commented 1 month ago

Looking at the fix it changed the string array return type for the ProjectSchema, but within the ExpandedGroupSchema it still returns a ProjectSchema array, is this intended then?

It isnt, just overlooked.