@@ -262,6 +262,15 @@ const RequestBody = ({
262
262
if ( testValueForJson ) {
263
263
language = "json"
264
264
}
265
+ const example = isExecute ? < RequestBodyEditor
266
+ value = { requestBodyValue }
267
+ errors = { requestBodyErrors }
268
+ defaultValue = { sampleRequestBody }
269
+ onChange = { onChange }
270
+ getComponent = { getComponent }
271
+ /> : < HighlightCode className = "body-param__example" language = { language } >
272
+ { stringify ( requestBodyValue ) || sampleRequestBody }
273
+ </ HighlightCode >
265
274
266
275
return < div >
267
276
{ requestBodyDescription &&
@@ -282,35 +291,17 @@ const RequestBody = ({
282
291
/>
283
292
) : null
284
293
}
285
- {
286
- isExecute ? (
287
- < div >
288
- < RequestBodyEditor
289
- value = { requestBodyValue }
290
- errors = { requestBodyErrors }
291
- defaultValue = { sampleRequestBody }
292
- onChange = { onChange }
293
- getComponent = { getComponent }
294
- />
295
- </ div >
296
- ) : (
297
- < ModelExample
298
- getComponent = { getComponent }
299
- getConfigs = { getConfigs }
300
- specSelectors = { specSelectors }
301
- expandDepth = { 1 }
302
- isExecute = { isExecute }
303
- schema = { mediaTypeValue . get ( "schema" ) }
304
- specPath = { specPath . push ( "content" , contentType ) }
305
- example = {
306
- < HighlightCode className = "body-param__example" language = { language } >
307
- { stringify ( requestBodyValue ) || sampleRequestBody }
308
- </ HighlightCode >
309
- }
310
- includeWriteOnly = { true }
311
- />
312
- )
313
- }
294
+ < ModelExample
295
+ getComponent = { getComponent }
296
+ getConfigs = { getConfigs }
297
+ specSelectors = { specSelectors }
298
+ expandDepth = { 1 }
299
+ isExecute = { isExecute }
300
+ schema = { mediaTypeValue . get ( "schema" ) }
301
+ specPath = { specPath . push ( "content" , contentType ) }
302
+ example = { example }
303
+ includeWriteOnly = { true }
304
+ />
314
305
{
315
306
sampleForMediaType ? (
316
307
< Example
0 commit comments