From 79d9052c32726e8590118371833d08ae31f12507 Mon Sep 17 00:00:00 2001 From: Stephan Meijer Date: Tue, 11 Jul 2023 12:09:10 +0200 Subject: [PATCH] chore: only use operation objects --- docs/lib/openapi.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/lib/openapi.ts b/docs/lib/openapi.ts index 292d022..2727318 100644 --- a/docs/lib/openapi.ts +++ b/docs/lib/openapi.ts @@ -40,12 +40,14 @@ export function getApiLinks(spec: OpenAPIV3.Document) { return Object.keys(spec.paths).flatMap((pathName) => { const path = spec.paths[pathName as keyof typeof spec.paths] || {}; - return Object.keys(path).map((method) => { - const { operationId, summary } = path[ - method as keyof typeof path - ] as OpenAPIV3.OperationObject; - - return { path: pathName, method, operationId, summary }; - }); + return Object.keys(path) + .map((method) => { + const { operationId, summary } = path[ + method as keyof typeof path + ] as OpenAPIV3.OperationObject; + + return { path: pathName, method, operationId, summary }; + }) + .filter((x) => x.operationId); }); }