Skip to content

Commit 84ba7eb

Browse files
committed
refactor: update paginationRegExp initialization properly and simplify property checks
1 parent b4cff74 commit 84ba7eb

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

packages/openapi-ts/src/openApi/3.0.x/parser/pagination.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,11 @@ export const paginationField = ({
7373
}
7474

7575
for (const name in schema.properties) {
76-
const paginationRegExp = getPaginationKeywordsRegExp(config);
76+
const paginationRegExp = getPaginationKeywordsRegExp(context.config);
7777
paginationRegExp.lastIndex = 0;
7878

7979
if (paginationRegExp.test(name)) {
80-
const property = schema.properties[name];
81-
82-
// Skip if property doesn't exist
83-
if (!property) continue;
80+
const property = schema.properties[name]!;
8481

8582
if (typeof property !== 'boolean' && !('$ref' in property)) {
8683
const schemaType = getSchemaType({ schema: property });
@@ -95,7 +92,6 @@ export const paginationField = ({
9592

9693
for (const allOf of schema.allOf ?? []) {
9794
const pagination = paginationField({
98-
config,
9995
context,
10096
name,
10197
schema: allOf,

packages/openapi-ts/src/openApi/3.1.x/parser/pagination.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,7 @@ export const paginationField = ({
7373
paginationRegExp.lastIndex = 0;
7474

7575
if (paginationRegExp.test(name)) {
76-
const property = schema.properties[name];
77-
78-
// Skip if property doesn't exist
79-
if (!property) continue;
76+
const property = schema.properties[name]!;
8077

8178
if (typeof property !== 'boolean') {
8279
// TODO: resolve deeper references

0 commit comments

Comments
 (0)