Skip to content

Commit

Permalink
fix: Update API Reference definitions (#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-md authored Dec 13, 2024
1 parent 8ee0200 commit 0dc3cf3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions components/ApiReference/Response.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@ 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 (
Expand Down

0 comments on commit 0dc3cf3

Please sign in to comment.