OpenAPI: show 'null' if there's a null enum value (#35058)
Co-authored-by: Peter Bengtsson <peterbe@github.com>
This commit is contained in:
@@ -106,24 +106,18 @@ export function ParameterRow({
|
|||||||
)}
|
)}
|
||||||
{rowParams.enum && rowParams.enum.length && (
|
{rowParams.enum && rowParams.enum.length && (
|
||||||
<p>
|
<p>
|
||||||
{rowParams.enum.length > 1 ? (
|
<span>
|
||||||
<>
|
{rowParams.enum.length === 1
|
||||||
<span>{t('enum_description_title')}: </span>
|
? t('single_enum_description')
|
||||||
|
: t('enum_description_title')}
|
||||||
|
:{' '}
|
||||||
|
</span>
|
||||||
{rowParams.enum.map((item, index, array) => (
|
{rowParams.enum.map((item, index, array) => (
|
||||||
<span key={item + index}>
|
<span key={`${item}${index}`}>
|
||||||
<code>{item}</code>
|
<code>{item === null ? <i>null</i> : item}</code>
|
||||||
{index !== array.length - 1 && ','}{' '}
|
{index !== array.length - 1 && ','}{' '}
|
||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<span>{t('single_enum_description')}: </span>
|
|
||||||
<span key={rowParams.enum[0]}>
|
|
||||||
<code>{rowParams.enum[0]}</code>
|
|
||||||
</span>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export interface ChildParameter {
|
|||||||
description: string
|
description: string
|
||||||
type: string
|
type: string
|
||||||
isRequired?: boolean
|
isRequired?: boolean
|
||||||
enum?: Array<string>
|
enum?: null | string[]
|
||||||
default?: string | boolean | number | undefined | string[]
|
default?: string | boolean | number | undefined | string[]
|
||||||
childParamsGroups?: ChildParameter[]
|
childParamsGroups?: ChildParameter[]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user