@@ -568,7 +568,11 @@ const createEndpointFromOperation = async (
568568 const draftMessage = parsedOperation [ 'x-draft' ]
569569
570570 const request = createRequest ( methods , operation , path )
571- const response = createResponse ( operation , path , context )
571+ const { hasPagination, ...response } = createResponse (
572+ operation ,
573+ path ,
574+ context ,
575+ )
572576
573577 const operationAuthMethods = parsedOperation . security . map (
574578 ( securitySchema ) => {
@@ -595,8 +599,7 @@ const createEndpointFromOperation = async (
595599 draftMessage,
596600 response,
597601 request,
598- // TODO: True if response properties contains the paginationResponseKey
599- hasPagination : false ,
602+ hasPagination,
600603 authMethods : endpointAuthMethods ,
601604 workspaceScope,
602605 }
@@ -909,7 +912,7 @@ const createResponse = (
909912 operation : OpenapiOperation ,
910913 path : string ,
911914 context : Context ,
912- ) : Response => {
915+ ) : Response & { hasPagination : boolean } => {
913916 if ( ! ( 'responses' in operation ) || operation . responses == null ) {
914917 throw new Error (
915918 `Missing responses in operation for ${ operation . operationId } ` ,
@@ -924,7 +927,11 @@ const createResponse = (
924927 const okResponse = responses [ '200' ]
925928
926929 if ( typeof okResponse !== 'object' || okResponse == null ) {
927- return { responseType : 'void' , description : 'Unknown' }
930+ return {
931+ responseType : 'void' ,
932+ description : 'Unknown' ,
933+ hasPagination : false ,
934+ }
928935 }
929936
930937 const description = okResponse . description ?? ''
@@ -939,6 +946,7 @@ const createResponse = (
939946 return {
940947 responseType : 'void' ,
941948 description,
949+ hasPagination : false ,
942950 }
943951 }
944952
@@ -951,6 +959,7 @@ const createResponse = (
951959 return {
952960 responseType : 'void' ,
953961 description,
962+ hasPagination : false ,
954963 }
955964 }
956965
@@ -960,6 +969,7 @@ const createResponse = (
960969 return {
961970 responseType : 'void' ,
962971 description,
972+ hasPagination : false ,
963973 }
964974 }
965975
@@ -968,6 +978,7 @@ const createResponse = (
968978 return {
969979 responseType : 'void' ,
970980 description,
981+ hasPagination : false ,
971982 }
972983 }
973984
@@ -1003,6 +1014,12 @@ const createResponse = (
10031014 responseKey : refKey ,
10041015 resourceType : refString ?. split ( '/' ) . at ( - 1 ) ?? 'unknown' ,
10051016 description,
1017+ hasPagination :
1018+ ( paginationResponseKey in properties &&
1019+ properties [ paginationResponseKey ] ?. $ref ?. endsWith (
1020+ `/${ paginationResponseKey } ` ,
1021+ ) ) ??
1022+ false ,
10061023 ...( actionAttemptType != null && { actionAttemptType } ) ,
10071024 }
10081025 }
@@ -1011,6 +1028,7 @@ const createResponse = (
10111028 return {
10121029 responseType : 'void' ,
10131030 description : 'Unknown' ,
1031+ hasPagination : false ,
10141032 }
10151033}
10161034
0 commit comments