1
0
mirror of synced 2025-12-23 11:54:18 -05:00

OpenAPI: show 'null' if there's a null enum value (#35058)

Co-authored-by: Peter Bengtsson <peterbe@github.com>
This commit is contained in:
Robert Sese
2023-02-28 12:56:31 -06:00
committed by GitHub
parent c5d08a7c19
commit 5978d98b49
2 changed files with 13 additions and 19 deletions

View File

@@ -106,24 +106,18 @@ export function ParameterRow({
)}
{rowParams.enum && rowParams.enum.length && (
<p>
{rowParams.enum.length > 1 ? (
<>
<span>{t('enum_description_title')}: </span>
{rowParams.enum.map((item, index, array) => (
<span key={item + index}>
<code>{item}</code>
{index !== array.length - 1 && ','}{' '}
</span>
))}
</>
) : (
<>
<span>{t('single_enum_description')}: </span>
<span key={rowParams.enum[0]}>
<code>{rowParams.enum[0]}</code>
</span>
</>
)}
<span>
{rowParams.enum.length === 1
? t('single_enum_description')
: t('enum_description_title')}
:{' '}
</span>
{rowParams.enum.map((item, index, array) => (
<span key={`${item}${index}`}>
<code>{item === null ? <i>null</i> : item}</code>
{index !== array.length - 1 && ','}{' '}
</span>
))}
</p>
)}
</div>

View File

@@ -26,7 +26,7 @@ export interface ChildParameter {
description: string
type: string
isRequired?: boolean
enum?: Array<string>
enum?: null | string[]
default?: string | boolean | number | undefined | string[]
childParamsGroups?: ChildParameter[]
}