From cb78031ce37190c3141118cbd994619120f58d04 Mon Sep 17 00:00:00 2001 From: Alex Varchuk Date: Thu, 13 Oct 2022 16:47:44 +0300 Subject: [PATCH] fix: default value for array query parameter --- src/components/Fields/FieldDetails.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Fields/FieldDetails.tsx b/src/components/Fields/FieldDetails.tsx index 36a43d3e..4a7f66d1 100644 --- a/src/components/Fields/FieldDetails.tsx +++ b/src/components/Fields/FieldDetails.tsx @@ -8,7 +8,7 @@ import { TypePrefix, TypeTitle, } from '../../common-elements/fields'; -import { getSerializedValue } from '../../utils'; +import { getSerializedValue, isObject } from '../../utils'; import { ExternalDocumentation } from '../ExternalDocumentation/ExternalDocumentation'; import { Markdown } from '../Markdown/Markdown'; import { EnumValues } from './EnumValues'; @@ -52,6 +52,10 @@ export const FieldDetailsComponent = observer((props: FieldProps) => { return null; }, [field, showExamples]); + const defaultValue = isObject(schema.default) + ? getSerializedValue(field, schema.default).replace(`${field.name}=`, '') + : schema.default; + return (
@@ -92,7 +96,7 @@ export const FieldDetailsComponent = observer((props: FieldProps) => { {l('deprecated')}
)} - + {!renderDiscriminatorSwitch && ( )}{' '}