···55import type { ImportExportItemObject } from '../../../compiler/utils';
66import { clientApi, clientModulePath } from '../../../generate/client';
77import { relativeModulePath } from '../../../generate/utils';
88-import { paginationKeywordsRegExp } from '../../../ir/pagination';
88+import { getPaginationKeywordsRegExp } from '../../../ir/pagination';
99import type { IR } from '../../../ir/types';
1010import { isOperationParameterRequired } from '../../../openApi';
1111import { getOperationKey } from '../../../openApi/common/parser/operation';
···900900 let paginationField!: Model | OperationParameter;
901901902902 const paginationParameter = operation.parameters.find((parameter) => {
903903- paginationKeywordsRegExp.lastIndex = 0;
904904- if (paginationKeywordsRegExp.test(parameter.name)) {
903903+ const paginationRegExp = getPaginationKeywordsRegExp(
904904+ config.input.pagination,
905905+ );
906906+ if (paginationRegExp.test(parameter.name)) {
905907 paginationField = parameter;
906908 return true;
907909 }
···916918 (model) => model.meta?.$ref === ref,
917919 );
918920 return refModel?.properties.find((property) => {
919919- paginationKeywordsRegExp.lastIndex = 0;
920920- if (paginationKeywordsRegExp.test(property.name)) {
921921+ const paginationRegExp = getPaginationKeywordsRegExp(
922922+ config.input.pagination,
923923+ );
924924+ if (paginationRegExp.test(property.name)) {
921925 paginationField = property;
922926 return true;
923927 }
···925929 }
926930927931 return parameter.properties.find((property) => {
928928- paginationKeywordsRegExp.lastIndex = 0;
929929- if (paginationKeywordsRegExp.test(property.name)) {
932932+ const paginationRegExp = getPaginationKeywordsRegExp(
933933+ config.input.pagination,
934934+ );
935935+ if (paginationRegExp.test(property.name)) {
930936 paginationField = property;
931937 return true;
932938 }
+13
packages/openapi-ts/src/types/config.d.ts
···6666 */
6767 organization?: string;
6868 /**
6969+ * Pagination configuration
7070+ */
7171+ pagination?: {
7272+ /**
7373+ * Array of keywords to be considered as pagination field names.
7474+ * These will be used to detect pagination fields in schemas and parameters.
7575+ *
7676+ * @default ['after', 'before', 'cursor', 'offset', 'page', 'start']
7777+ */
7878+ keywords?: ReadonlyArray<string>;
7979+ };
8080+ /**
6981 * Path to the OpenAPI specification. This can be either local or remote path.
7082 * Both JSON and YAML file formats are supported. You can also pass the parsed
7183 * object directly if you're fetching the file yourself.
···88100 * the first match will be returned.
89101 */
90102 tags?: ReadonlyArray<string>;
103103+91104 /**
92105 * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
93106 *