Skip to content

Commit 8b3b456

Browse files
Simplify getOpenapiResponseProperties
1 parent cedcdf1 commit 8b3b456

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/lib/report.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,18 +320,16 @@ function processResponseKeys(endpoint: Endpoint, report: Report): void {
320320

321321
function getOpenapiResponseProperties(
322322
path: string,
323-
): Record<string, unknown> | undefined | null {
323+
): Record<string, unknown> | null {
324324
const openapiEndpointDef = openapi.paths[path as keyof typeof openapi.paths]
325325

326326
if (openapiEndpointDef == null) {
327327
// eslint-disable-next-line no-console
328328
console.warn(`OpenAPI definition not found for endpoint: ${path}`)
329-
return undefined
329+
return null
330330
}
331331

332-
if (openapiEndpointDef.post?.responses == null) {
333-
return undefined
334-
}
332+
if (openapiEndpointDef.post?.responses == null) return null
335333

336334
const responseObj = openapiEndpointDef.post.responses['200']
337335

@@ -346,7 +344,7 @@ function getOpenapiResponseProperties(
346344
}
347345
}
348346

349-
return undefined
347+
return null
350348
}
351349

352350
function processParameters(

0 commit comments

Comments
 (0)