From 013b5a9a7c1b36d8948d8da88b4b9c30b666b89d Mon Sep 17 00:00:00 2001 From: louis-md Date: Thu, 12 Dec 2024 15:54:00 +0100 Subject: [PATCH 1/2] Fix definitions linking in API reference --- components/ApiReference/Response.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/components/ApiReference/Response.tsx b/components/ApiReference/Response.tsx index 79e8f800..95f85166 100644 --- a/components/ApiReference/Response.tsx +++ b/components/ApiReference/Response.tsx @@ -16,19 +16,23 @@ const Response: React.FC<{ response: any; index: number }> = ({ index }) => { const isSuccess = response.code.startsWith('2') === true - const type = response.schema?.type + const content = response.content?.['application/json'] + const type = content?.schema?.type const properties = type === undefined ? [] : Object.entries( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - type === 'object' - ? response.schema?.properties - : response.schema?.items + (type === 'object' + ? content?.schema?.properties + : content?.schema?.items) ?? {} ).map(([key, value]) => ({ name: key, value, - required: response.schema?.required?.includes(key) + required: + content?.schema?.required?.includes( + key + ) })) return ( From 6b0174ea76167e45c591c122242564bea1e56cfc Mon Sep 17 00:00:00 2001 From: louis-md Date: Thu, 12 Dec 2024 15:55:20 +0100 Subject: [PATCH 2/2] Lint --- components/ApiReference/Response.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/components/ApiReference/Response.tsx b/components/ApiReference/Response.tsx index 95f85166..0242d70d 100644 --- a/components/ApiReference/Response.tsx +++ b/components/ApiReference/Response.tsx @@ -29,10 +29,7 @@ const Response: React.FC<{ response: any; index: number }> = ({ ).map(([key, value]) => ({ name: key, value, - required: - content?.schema?.required?.includes( - key - ) + required: content?.schema?.required?.includes(key) })) return (