File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 8
8
TypePrefix ,
9
9
TypeTitle ,
10
10
} from '../../common-elements/fields' ;
11
- import { getSerializedValue } from '../../utils' ;
11
+ import { getSerializedValue , isObject } from '../../utils' ;
12
12
import { ExternalDocumentation } from '../ExternalDocumentation/ExternalDocumentation' ;
13
13
import { Markdown } from '../Markdown/Markdown' ;
14
14
import { EnumValues } from './EnumValues' ;
@@ -52,6 +52,10 @@ export const FieldDetailsComponent = observer((props: FieldProps) => {
52
52
return null ;
53
53
} , [ field , showExamples ] ) ;
54
54
55
+ const defaultValue = isObject ( schema . default )
56
+ ? getSerializedValue ( field , schema . default ) . replace ( `${ field . name } =` , '' )
57
+ : schema . default ;
58
+
55
59
return (
56
60
< div >
57
61
< div >
@@ -92,7 +96,7 @@ export const FieldDetailsComponent = observer((props: FieldProps) => {
92
96
< Badge type = "warning" > { l ( 'deprecated' ) } </ Badge >
93
97
</ div >
94
98
) }
95
- < FieldDetail raw = { rawDefault } label = { l ( 'default' ) + ':' } value = { schema . default } />
99
+ < FieldDetail raw = { rawDefault } label = { l ( 'default' ) + ':' } value = { defaultValue } />
96
100
{ ! renderDiscriminatorSwitch && (
97
101
< EnumValues isArrayType = { isArrayType } values = { schema . enum } />
98
102
) } { ' ' }
You can’t perform that action at this time.
0 commit comments