File tree Expand file tree Collapse file tree 1 file changed +29
-7
lines changed
packages/docusaurus-theme-openapi-docs/src/theme/SchemaItem Expand file tree Collapse file tree 1 file changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ export default function SchemaItem(props: Props) {
65
65
} = props ;
66
66
let deprecated ;
67
67
let schemaDescription ;
68
- let defaultValue ;
68
+ let defaultValue : string | undefined ;
69
69
let nullable ;
70
70
let enumDescriptions : [ string , string ] [ ] = [ ] ;
71
71
@@ -133,11 +133,33 @@ export default function SchemaItem(props: Props) {
133
133
</ div >
134
134
) ) ;
135
135
136
- const renderDefaultValue = guard ( defaultValue , ( value ) => (
137
- < div className = "" >
138
- < ReactMarkdown children = { `**Default value:** \`${ value } \`` } />
139
- </ div >
140
- ) ) ;
136
+ function renderDefaultValue ( ) {
137
+ if ( defaultValue !== undefined ) {
138
+ if ( typeof defaultValue === "string" ) {
139
+ return (
140
+ < div >
141
+ < strong >
142
+ Default value:{ " " }
143
+ < span >
144
+ < code > { defaultValue } </ code >
145
+ </ span >
146
+ </ strong >
147
+ </ div >
148
+ ) ;
149
+ }
150
+ return (
151
+ < div >
152
+ < strong >
153
+ Default value:{ " " }
154
+ < span >
155
+ < code > { JSON . stringify ( defaultValue ) } </ code >
156
+ </ span >
157
+ </ strong >
158
+ </ div >
159
+ ) ;
160
+ }
161
+ return undefined ;
162
+ }
141
163
142
164
const schemaContent = (
143
165
< div >
@@ -158,7 +180,7 @@ export default function SchemaItem(props: Props) {
158
180
{ renderDeprecated }
159
181
</ span >
160
182
{ renderQualifierMessage }
161
- { renderDefaultValue }
183
+ { renderDefaultValue ( ) }
162
184
{ renderSchemaDescription }
163
185
{ renderEnumDescriptions }
164
186
{ collapsibleSchemaContent ?? collapsibleSchemaContent }
You can’t perform that action at this time.
0 commit comments