Skip to content

Commit 51a682d

Browse files
committed
refactor: simplify property existence checks
1 parent 84ba7eb commit 51a682d

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

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

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

9090
if (paginationRegExp.test(name)) {
91-
const property = schema.properties[name];
92-
93-
// Skip if property doesn't exist
94-
if (!property) continue;
91+
const property = schema.properties[name]!;
9592

9693
if (typeof property !== 'boolean' && !('$ref' in property)) {
9794
const schemaType = getSchemaType({ schema: property });

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
@@ -85,10 +85,7 @@ export const paginationField = ({
8585
(schema) => schema.type !== 'null',
8686
);
8787
if (nonNullCompositionSchemas.length === 1) {
88-
const firstSchema = nonNullCompositionSchemas[0];
89-
90-
// Skip if schema doesn't exist
91-
if (!firstSchema) continue;
88+
const firstSchema = nonNullCompositionSchemas[0]!;
9289

9390
const schemaTypes = getSchemaTypes({
9491
schema: firstSchema,

0 commit comments

Comments
 (0)