1
1
import { z } from "zod" ;
2
- import { flexibleBoolean , numericStringSchema , numericStringSchemaNullable } from "./customSchemas.js"
2
+ import { flexibleBoolean } from "./customSchemas.js"
3
3
4
4
// Base schemas for common types
5
5
export const GitLabAuthorSchema = z . object ( {
@@ -147,13 +147,13 @@ export const ListPipelinesSchema = z.object({
147
147
// Schema for getting a specific pipeline
148
148
export const GetPipelineSchema = z . object ( {
149
149
project_id : z . coerce . string ( ) . describe ( "Project ID or URL-encoded path" ) ,
150
- pipeline_id : numericStringSchema . describe ( "The ID of the pipeline" ) ,
150
+ pipeline_id : z . coerce . string ( ) . describe ( "The ID of the pipeline" ) ,
151
151
} ) ;
152
152
153
153
// Schema for listing jobs in a pipeline
154
154
export const ListPipelineJobsSchema = z . object ( {
155
155
project_id : z . coerce . string ( ) . describe ( "Project ID or URL-encoded path" ) ,
156
- pipeline_id : numericStringSchema . describe ( "The ID of the pipeline" ) ,
156
+ pipeline_id : z . coerce . string ( ) . describe ( "The ID of the pipeline" ) ,
157
157
scope : z
158
158
. enum ( [ "created" , "pending" , "running" , "failed" , "success" , "canceled" , "skipped" , "manual" ] )
159
159
. optional ( )
@@ -179,7 +179,7 @@ export const CreatePipelineSchema = z.object({
179
179
// Schema for retrying a pipeline
180
180
export const RetryPipelineSchema = z . object ( {
181
181
project_id : z . coerce . string ( ) . describe ( "Project ID or URL-encoded path" ) ,
182
- pipeline_id : numericStringSchema . describe ( "The ID of the pipeline to retry" ) ,
182
+ pipeline_id : z . coerce . string ( ) . describe ( "The ID of the pipeline to retry" ) ,
183
183
} ) ;
184
184
185
185
// Schema for canceling a pipeline
@@ -188,7 +188,7 @@ export const CancelPipelineSchema = RetryPipelineSchema
188
188
// Schema for the input parameters for pipeline job operations
189
189
export const GetPipelineJobOutputSchema = z . object ( {
190
190
project_id : z . coerce . string ( ) . describe ( "Project ID or URL-encoded path" ) ,
191
- job_id : numericStringSchema . describe ( "The ID of the job" ) ,
191
+ job_id : z . coerce . string ( ) . describe ( "The ID of the job" ) ,
192
192
limit : z . number ( ) . optional ( ) . describe ( "Maximum number of lines to return from the end of the log (default: 1000)" ) ,
193
193
offset : z . number ( ) . optional ( ) . describe ( "Number of lines to skip from the end of the log (default: 0)" ) ,
194
194
} ) ;
@@ -432,7 +432,7 @@ export const GitLabReferenceSchema = z.object({
432
432
// Milestones rest api output schemas
433
433
export const GitLabMilestonesSchema = z . object ( {
434
434
id : z . coerce . string ( ) ,
435
- iid : numericStringSchema ,
435
+ iid : z . coerce . string ( ) ,
436
436
project_id : z . coerce . string ( ) ,
437
437
title : z . string ( ) ,
438
438
description : z . string ( ) . nullable ( ) ,
@@ -457,7 +457,7 @@ export const CreateIssueOptionsSchema = z.object({
457
457
title : z . string ( ) ,
458
458
description : z . string ( ) . optional ( ) , // Changed from body to match GitLab API
459
459
assignee_ids : z . array ( z . number ( ) ) . optional ( ) , // Changed from assignees to match GitLab API
460
- milestone_id : numericStringSchema . optional ( ) , // Changed from milestone to match GitLab API
460
+ milestone_id : z . coerce . string ( ) . optional ( ) , // Changed from milestone to match GitLab API
461
461
labels : z . array ( z . string ( ) ) . optional ( ) ,
462
462
} ) ;
463
463
@@ -527,7 +527,7 @@ export const GitLabLabelSchema = z.object({
527
527
528
528
export const GitLabMilestoneSchema = z . object ( {
529
529
id : z . coerce . string ( ) ,
530
- iid : numericStringSchema , // Added to match GitLab API
530
+ iid : z . coerce . string ( ) , // Added to match GitLab API
531
531
title : z . string ( ) ,
532
532
description : z . string ( ) . nullable ( ) . default ( "" ) ,
533
533
state : z . string ( ) ,
@@ -536,7 +536,7 @@ export const GitLabMilestoneSchema = z.object({
536
536
537
537
export const GitLabIssueSchema = z . object ( {
538
538
id : z . coerce . string ( ) ,
539
- iid : numericStringSchema , // Added to match GitLab API
539
+ iid : z . coerce . string ( ) , // Added to match GitLab API
540
540
project_id : z . coerce . string ( ) , // Added to match GitLab API
541
541
title : z . string ( ) ,
542
542
description : z . string ( ) . nullable ( ) . default ( "" ) , // Changed from body to match GitLab API
@@ -605,7 +605,7 @@ export const GitLabMergeRequestDiffRefSchema = z.object({
605
605
606
606
export const GitLabMergeRequestSchema = z . object ( {
607
607
id : z . coerce . string ( ) ,
608
- iid : numericStringSchema ,
608
+ iid : z . coerce . string ( ) ,
609
609
project_id : z . coerce . string ( ) ,
610
610
title : z . string ( ) ,
611
611
description : z . string ( ) . nullable ( ) ,
@@ -664,10 +664,10 @@ export const GitLabDiscussionNoteSchema = z.object({
664
664
created_at : z . string ( ) ,
665
665
updated_at : z . string ( ) ,
666
666
system : flexibleBoolean ,
667
- noteable_id : numericStringSchema ,
667
+ noteable_id : z . coerce . string ( ) ,
668
668
noteable_type : z . enum ( [ "Issue" , "MergeRequest" , "Snippet" , "Commit" , "Epic" ] ) ,
669
669
project_id : z . coerce . string ( ) . optional ( ) ,
670
- noteable_iid : numericStringSchemaNullable . optional ( ) ,
670
+ noteable_iid : z . coerce . string ( ) . nullable ( ) . optional ( ) ,
671
671
resolvable : flexibleBoolean . optional ( ) ,
672
672
resolved : flexibleBoolean . optional ( ) ,
673
673
resolved_by : GitLabUserSchema . nullable ( ) . optional ( ) ,
@@ -729,19 +729,19 @@ export type PaginatedDiscussionsResponse = z.infer<typeof PaginatedDiscussionsRe
729
729
730
730
export const ListIssueDiscussionsSchema = z . object ( {
731
731
project_id : z . coerce . string ( ) . describe ( "Project ID or URL-encoded path" ) ,
732
- issue_iid : numericStringSchema . describe ( "The internal ID of the project issue" ) ,
732
+ issue_iid : z . coerce . string ( ) . describe ( "The internal ID of the project issue" ) ,
733
733
} ) . merge ( PaginationOptionsSchema ) ;
734
734
735
735
// Input schema for listing merge request discussions
736
736
export const ListMergeRequestDiscussionsSchema = ProjectParamsSchema . extend ( {
737
- merge_request_iid : numericStringSchema . describe ( "The IID of a merge request" ) ,
737
+ merge_request_iid : z . coerce . string ( ) . describe ( "The IID of a merge request" ) ,
738
738
} ) . merge ( PaginationOptionsSchema ) ;
739
739
740
740
// Input schema for updating a merge request discussion note
741
741
export const UpdateMergeRequestNoteSchema = ProjectParamsSchema . extend ( {
742
- merge_request_iid : numericStringSchema . describe ( "The IID of a merge request" ) ,
743
- discussion_id : numericStringSchema . describe ( "The ID of a thread" ) ,
744
- note_id : numericStringSchema . describe ( "The ID of a thread note" ) ,
742
+ merge_request_iid : z . coerce . string ( ) . describe ( "The IID of a merge request" ) ,
743
+ discussion_id : z . coerce . string ( ) . describe ( "The ID of a thread" ) ,
744
+ note_id : z . coerce . string ( ) . describe ( "The ID of a thread note" ) ,
745
745
body : z . string ( ) . optional ( ) . describe ( "The content of the note or reply" ) ,
746
746
resolved : flexibleBoolean . optional ( ) . describe ( "Resolve or unresolve the note" ) ,
747
747
} )
@@ -754,24 +754,24 @@ export const UpdateMergeRequestNoteSchema = ProjectParamsSchema.extend({
754
754
755
755
// Input schema for adding a note to an existing merge request discussion
756
756
export const CreateMergeRequestNoteSchema = ProjectParamsSchema . extend ( {
757
- merge_request_iid : numericStringSchema . describe ( "The IID of a merge request" ) ,
758
- discussion_id : numericStringSchema . describe ( "The ID of a thread" ) ,
757
+ merge_request_iid : z . coerce . string ( ) . describe ( "The IID of a merge request" ) ,
758
+ discussion_id : z . coerce . string ( ) . describe ( "The ID of a thread" ) ,
759
759
body : z . string ( ) . describe ( "The content of the note or reply" ) ,
760
760
created_at : z . string ( ) . optional ( ) . describe ( "Date the note was created at (ISO 8601 format)" ) ,
761
761
} ) ;
762
762
763
763
// Input schema for updating an issue discussion note
764
764
export const UpdateIssueNoteSchema = ProjectParamsSchema . extend ( {
765
- issue_iid : numericStringSchema . describe ( "The IID of an issue" ) ,
766
- discussion_id : numericStringSchema . describe ( "The ID of a thread" ) ,
767
- note_id : numericStringSchema . describe ( "The ID of a thread note" ) ,
765
+ issue_iid : z . coerce . string ( ) . describe ( "The IID of an issue" ) ,
766
+ discussion_id : z . coerce . string ( ) . describe ( "The ID of a thread" ) ,
767
+ note_id : z . coerce . string ( ) . describe ( "The ID of a thread note" ) ,
768
768
body : z . string ( ) . describe ( "The content of the note or reply" ) ,
769
769
} ) ;
770
770
771
771
// Input schema for adding a note to an existing issue discussion
772
772
export const CreateIssueNoteSchema = ProjectParamsSchema . extend ( {
773
- issue_iid : numericStringSchema . describe ( "The IID of an issue" ) ,
774
- discussion_id : numericStringSchema . describe ( "The ID of a thread" ) ,
773
+ issue_iid : z . coerce . string ( ) . describe ( "The IID of an issue" ) ,
774
+ discussion_id : z . coerce . string ( ) . describe ( "The ID of a thread" ) ,
775
775
body : z . string ( ) . describe ( "The content of the note or reply" ) ,
776
776
created_at : z . string ( ) . optional ( ) . describe ( "Date the note was created at (ISO 8601 format)" ) ,
777
777
} ) ;
@@ -825,7 +825,7 @@ export const CreateIssueSchema = ProjectParamsSchema.extend({
825
825
description : z . string ( ) . optional ( ) . describe ( "Issue description" ) ,
826
826
assignee_ids : z . array ( z . number ( ) ) . optional ( ) . describe ( "Array of user IDs to assign" ) ,
827
827
labels : z . array ( z . string ( ) ) . optional ( ) . describe ( "Array of label names" ) ,
828
- milestone_id : numericStringSchema . optional ( ) . describe ( "Milestone ID to assign" ) ,
828
+ milestone_id : z . coerce . string ( ) . optional ( ) . describe ( "Milestone ID to assign" ) ,
829
829
} ) ;
830
830
831
831
const MergeRequestOptionsSchema = {
@@ -873,7 +873,7 @@ export const GetBranchDiffsSchema = ProjectParamsSchema.extend({
873
873
} ) ;
874
874
875
875
export const GetMergeRequestSchema = ProjectParamsSchema . extend ( {
876
- merge_request_iid : numericStringSchema . optional ( ) . describe ( "The IID of a merge request" ) ,
876
+ merge_request_iid : z . coerce . string ( ) . optional ( ) . describe ( "The IID of a merge request" ) ,
877
877
source_branch : z . string ( ) . optional ( ) . describe ( "Source branch name" ) ,
878
878
} ) ;
879
879
@@ -917,7 +917,7 @@ export const CreateNoteSchema = z.object({
917
917
noteable_type : z
918
918
. enum ( [ "issue" , "merge_request" ] )
919
919
. describe ( "Type of noteable (issue or merge_request)" ) ,
920
- noteable_iid : numericStringSchema . describe ( "IID of the issue or merge request" ) ,
920
+ noteable_iid : z . coerce . string ( ) . describe ( "IID of the issue or merge request" ) ,
921
921
body : z . string ( ) . describe ( "Note content" ) ,
922
922
} ) ;
923
923
@@ -926,7 +926,7 @@ export const ListIssuesSchema = z.object({
926
926
project_id : z . coerce . string ( ) . describe ( "Project ID or URL-encoded path" ) ,
927
927
assignee_id : z . coerce . string ( ) . optional ( ) . describe ( "Return issues assigned to the given user ID. user id or none or any" ) ,
928
928
assignee_username : z . array ( z . string ( ) ) . optional ( ) . describe ( "Return issues assigned to the given username" ) ,
929
- author_id : numericStringSchema . optional ( ) . describe ( "Return issues created by the given user ID" ) ,
929
+ author_id : z . coerce . string ( ) . optional ( ) . describe ( "Return issues created by the given user ID" ) ,
930
930
author_username : z . string ( ) . optional ( ) . describe ( "Return issues created by the given username" ) ,
931
931
confidential : flexibleBoolean . optional ( ) . describe ( "Filter confidential or public issues" ) ,
932
932
created_after : z . string ( ) . optional ( ) . describe ( "Return issues created after the given time" ) ,
@@ -956,7 +956,7 @@ export const ListMergeRequestsSchema = z.object({
956
956
. string ( )
957
957
. optional ( )
958
958
. describe ( "Returns merge requests assigned to the given username" ) ,
959
- author_id : numericStringSchema . optional ( ) . describe ( "Returns merge requests created by the given user ID" ) ,
959
+ author_id : z . coerce . string ( ) . optional ( ) . describe ( "Returns merge requests created by the given user ID" ) ,
960
960
author_username : z
961
961
. string ( )
962
962
. optional ( )
@@ -1017,27 +1017,27 @@ export const ListMergeRequestsSchema = z.object({
1017
1017
1018
1018
export const GetIssueSchema = z . object ( {
1019
1019
project_id : z . coerce . string ( ) . describe ( "Project ID or URL-encoded path" ) ,
1020
- issue_iid : numericStringSchema . describe ( "The internal ID of the project issue" ) ,
1020
+ issue_iid : z . coerce . string ( ) . describe ( "The internal ID of the project issue" ) ,
1021
1021
} ) ;
1022
1022
1023
1023
export const UpdateIssueSchema = z . object ( {
1024
1024
project_id : z . coerce . string ( ) . describe ( "Project ID or URL-encoded path" ) ,
1025
- issue_iid : numericStringSchema . describe ( "The internal ID of the project issue" ) ,
1025
+ issue_iid : z . coerce . string ( ) . describe ( "The internal ID of the project issue" ) ,
1026
1026
title : z . string ( ) . optional ( ) . describe ( "The title of the issue" ) ,
1027
1027
description : z . string ( ) . optional ( ) . describe ( "The description of the issue" ) ,
1028
1028
assignee_ids : z . array ( z . number ( ) ) . optional ( ) . describe ( "Array of user IDs to assign issue to" ) ,
1029
1029
confidential : flexibleBoolean . optional ( ) . describe ( "Set the issue to be confidential" ) ,
1030
1030
discussion_locked : flexibleBoolean . optional ( ) . describe ( "Flag to lock discussions" ) ,
1031
1031
due_date : z . string ( ) . optional ( ) . describe ( "Date the issue is due (YYYY-MM-DD)" ) ,
1032
1032
labels : z . array ( z . string ( ) ) . optional ( ) . describe ( "Array of label names" ) ,
1033
- milestone_id : numericStringSchema . optional ( ) . describe ( "Milestone ID to assign" ) ,
1033
+ milestone_id : z . coerce . string ( ) . optional ( ) . describe ( "Milestone ID to assign" ) ,
1034
1034
state_event : z . enum ( [ "close" , "reopen" ] ) . optional ( ) . describe ( "Update issue state (close/reopen)" ) ,
1035
1035
weight : z . number ( ) . optional ( ) . describe ( "Weight of the issue (0-9)" ) ,
1036
1036
} ) ;
1037
1037
1038
1038
export const DeleteIssueSchema = z . object ( {
1039
1039
project_id : z . coerce . string ( ) . describe ( "Project ID or URL-encoded path" ) ,
1040
- issue_iid : numericStringSchema . describe ( "The internal ID of the project issue" ) ,
1040
+ issue_iid : z . coerce . string ( ) . describe ( "The internal ID of the project issue" ) ,
1041
1041
} ) ;
1042
1042
1043
1043
// Issue links related schemas
@@ -1049,20 +1049,20 @@ export const GitLabIssueLinkSchema = z.object({
1049
1049
1050
1050
export const ListIssueLinksSchema = z . object ( {
1051
1051
project_id : z . coerce . string ( ) . describe ( "Project ID or URL-encoded path" ) ,
1052
- issue_iid : numericStringSchema . describe ( "The internal ID of a project's issue" ) ,
1052
+ issue_iid : z . coerce . string ( ) . describe ( "The internal ID of a project's issue" ) ,
1053
1053
} ) ;
1054
1054
1055
1055
export const GetIssueLinkSchema = z . object ( {
1056
1056
project_id : z . coerce . string ( ) . describe ( "Project ID or URL-encoded path" ) ,
1057
- issue_iid : numericStringSchema . describe ( "The internal ID of a project's issue" ) ,
1057
+ issue_iid : z . coerce . string ( ) . describe ( "The internal ID of a project's issue" ) ,
1058
1058
issue_link_id : z . coerce . string ( ) . describe ( "ID of an issue relationship" ) ,
1059
1059
} ) ;
1060
1060
1061
1061
export const CreateIssueLinkSchema = z . object ( {
1062
1062
project_id : z . coerce . string ( ) . describe ( "Project ID or URL-encoded path" ) ,
1063
- issue_iid : numericStringSchema . describe ( "The internal ID of a project's issue" ) ,
1063
+ issue_iid : z . coerce . string ( ) . describe ( "The internal ID of a project's issue" ) ,
1064
1064
target_project_id : z . coerce . string ( ) . describe ( "The ID or URL-encoded path of a target project" ) ,
1065
- target_issue_iid : numericStringSchema . describe ( "The internal ID of a target project's issue" ) ,
1065
+ target_issue_iid : z . coerce . string ( ) . describe ( "The internal ID of a target project's issue" ) ,
1066
1066
link_type : z
1067
1067
. enum ( [ "relates_to" , "blocks" , "is_blocked_by" ] )
1068
1068
. optional ( )
@@ -1071,7 +1071,7 @@ export const CreateIssueLinkSchema = z.object({
1071
1071
1072
1072
export const DeleteIssueLinkSchema = z . object ( {
1073
1073
project_id : z . coerce . string ( ) . describe ( "Project ID or URL-encoded path" ) ,
1074
- issue_iid : numericStringSchema . describe ( "The internal ID of a project's issue" ) ,
1074
+ issue_iid : z . coerce . string ( ) . describe ( "The internal ID of a project's issue" ) ,
1075
1075
issue_link_id : z . coerce . string ( ) . describe ( "The ID of an issue relationship" ) ,
1076
1076
} ) ;
1077
1077
@@ -1257,7 +1257,7 @@ export const MergeRequestThreadPositionSchema = z.object({
1257
1257
1258
1258
// Schema for creating a new merge request thread
1259
1259
export const CreateMergeRequestThreadSchema = ProjectParamsSchema . extend ( {
1260
- merge_request_iid : numericStringSchema . describe ( "The IID of a merge request" ) ,
1260
+ merge_request_iid : z . coerce . string ( ) . describe ( "The IID of a merge request" ) ,
1261
1261
body : z . string ( ) . describe ( "The content of the thread" ) ,
1262
1262
position : MergeRequestThreadPositionSchema . optional ( ) . describe (
1263
1263
"Position when creating a diff note"
@@ -1294,7 +1294,7 @@ export const ListProjectMilestonesSchema = ProjectParamsSchema.extend({
1294
1294
1295
1295
// Schema for getting a single milestone
1296
1296
export const GetProjectMilestoneSchema = ProjectParamsSchema . extend ( {
1297
- milestone_id : numericStringSchema . describe ( "The ID of a project milestone" ) ,
1297
+ milestone_id : z . coerce . string ( ) . describe ( "The ID of a project milestone" ) ,
1298
1298
} ) ;
1299
1299
1300
1300
// Schema for creating a new milestone
0 commit comments