Skip to content

Commit 8664e5e

Browse files
committed
Issue 564: align minAccessLevel with supported values
Restrict GitLab minAccessLevel to 5, 10, 20, 30, 40, and 50 across schemas and generated types, and exclude NO_ACCESS in backend typing.
1 parent 40a7708 commit 8664e5e

File tree

8 files changed

+11
-15
lines changed

8 files changed

+11
-15
lines changed

packages/backend/src/gitlab.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export enum AccessLevel {
2222
ADMIN = 60,
2323
}
2424

25-
type ProjectsAccessLevel = Exclude<AccessLevel, AccessLevel.ADMIN>;
25+
type ProjectsAccessLevel = Exclude<AccessLevel, AccessLevel.ADMIN | AccessLevel.NO_ACCESS>;
2626

2727
export const createGitLabFromPersonalAccessToken = async ({ token, url }: { token?: string, url?: string }) => {
2828
const isGitLabCloud = url ? new URL(url).hostname === GITLAB_CLOUD_HOSTNAME : true;

packages/schemas/src/v3/connection.schema.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,14 @@ const schema = {
293293
"minAccessLevel": {
294294
"type": "integer",
295295
"enum": [
296-
0,
297296
5,
298297
10,
299298
20,
300299
30,
301300
40,
302301
50
303302
],
304-
"description": "Minimum GitLab access level required for projects to be returned. Uses GitLab role levels where 20=Reporter, 30=Developer, 40=Maintainer, and 50=Owner. Note: GitLab project listing APIs do not accept 60 (Admin) for this field."
303+
"description": "Minimum GitLab access level required for projects to be returned. Uses GitLab role levels where 20=Reporter, 30=Developer, 40=Maintainer, and 50=Owner."
305304
},
306305
"projects": {
307306
"type": "array",

packages/schemas/src/v3/connection.type.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ export interface GitlabConnectionConfig {
136136
*/
137137
groups?: string[];
138138
/**
139-
* Minimum GitLab access level required for projects to be returned. Uses GitLab role levels where 20=Reporter, 30=Developer, 40=Maintainer, and 50=Owner. Note: GitLab project listing APIs do not accept 60 (Admin) for this field.
139+
* Minimum GitLab access level required for projects to be returned. Uses GitLab role levels where 20=Reporter, 30=Developer, 40=Maintainer, and 50=Owner.
140140
*/
141-
minAccessLevel?: 0 | 5 | 10 | 20 | 30 | 40 | 50;
141+
minAccessLevel?: 5 | 10 | 20 | 30 | 40 | 50;
142142
/**
143143
* List of individual projects to sync with. The project's namespace must be specified. See: https://docs.gitlab.com/ee/user/namespace/
144144
*/

packages/schemas/src/v3/gitlab.schema.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,14 @@ const schema = {
8181
"minAccessLevel": {
8282
"type": "integer",
8383
"enum": [
84-
0,
8584
5,
8685
10,
8786
20,
8887
30,
8988
40,
9089
50
9190
],
92-
"description": "Minimum GitLab access level required for projects to be returned. Uses GitLab role levels where 20=Reporter, 30=Developer, 40=Maintainer, and 50=Owner. Note: GitLab project listing APIs do not accept 60 (Admin) for this field."
91+
"description": "Minimum GitLab access level required for projects to be returned. Uses GitLab role levels where 20=Reporter, 30=Developer, 40=Maintainer, and 50=Owner."
9392
},
9493
"projects": {
9594
"type": "array",

packages/schemas/src/v3/gitlab.type.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ export interface GitlabConnectionConfig {
3838
*/
3939
groups?: string[];
4040
/**
41-
* Minimum GitLab access level required for projects to be returned. Uses GitLab role levels where 20=Reporter, 30=Developer, 40=Maintainer, and 50=Owner. Note: GitLab project listing APIs do not accept 60 (Admin) for this field.
41+
* Minimum GitLab access level required for projects to be returned. Uses GitLab role levels where 20=Reporter, 30=Developer, 40=Maintainer, and 50=Owner.
4242
*/
43-
minAccessLevel?: 0 | 5 | 10 | 20 | 30 | 40 | 50;
43+
minAccessLevel?: 5 | 10 | 20 | 30 | 40 | 50;
4444
/**
4545
* List of individual projects to sync with. The project's namespace must be specified. See: https://docs.gitlab.com/ee/user/namespace/
4646
*/

packages/schemas/src/v3/index.schema.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,15 +708,14 @@ const schema = {
708708
"minAccessLevel": {
709709
"type": "integer",
710710
"enum": [
711-
0,
712711
5,
713712
10,
714713
20,
715714
30,
716715
40,
717716
50
718717
],
719-
"description": "Minimum GitLab access level required for projects to be returned. Uses GitLab role levels where 20=Reporter, 30=Developer, 40=Maintainer, and 50=Owner. Note: GitLab project listing APIs do not accept 60 (Admin) for this field."
718+
"description": "Minimum GitLab access level required for projects to be returned. Uses GitLab role levels where 20=Reporter, 30=Developer, 40=Maintainer, and 50=Owner."
720719
},
721720
"projects": {
722721
"type": "array",

packages/schemas/src/v3/index.type.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,9 @@ export interface GitlabConnectionConfig {
334334
*/
335335
groups?: string[];
336336
/**
337-
* Minimum GitLab access level required for projects to be returned. Uses GitLab role levels where 20=Reporter, 30=Developer, 40=Maintainer, and 50=Owner. Note: GitLab project listing APIs do not accept 60 (Admin) for this field.
337+
* Minimum GitLab access level required for projects to be returned. Uses GitLab role levels where 20=Reporter, 30=Developer, 40=Maintainer, and 50=Owner.
338338
*/
339-
minAccessLevel?: 0 | 5 | 10 | 20 | 30 | 40 | 50;
339+
minAccessLevel?: 5 | 10 | 20 | 30 | 40 | 50;
340340
/**
341341
* List of individual projects to sync with. The project's namespace must be specified. See: https://docs.gitlab.com/ee/user/namespace/
342342
*/

schemas/v3/gitlab.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,14 @@
5353
"minAccessLevel": {
5454
"type": "integer",
5555
"enum": [
56-
0,
5756
5,
5857
10,
5958
20,
6059
30,
6160
40,
6261
50
6362
],
64-
"description": "Minimum GitLab access level required for projects to be returned. Uses GitLab role levels where 20=Reporter, 30=Developer, 40=Maintainer, and 50=Owner. Note: GitLab project listing APIs do not accept 60 (Admin) for this field."
63+
"description": "Minimum GitLab access level required for projects to be returned. Uses GitLab role levels where 20=Reporter, 30=Developer, 40=Maintainer, and 50=Owner."
6564
},
6665
"projects": {
6766
"type": "array",

0 commit comments

Comments
 (0)