mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-10-31 07:47:29 +03:00 
			
		
		
		
	
							parent
							
								
									ed9b878efe
								
							
						
					
					
						commit
						56ca3716b3
					
				|  | @ -4,11 +4,12 @@ import { ParametersGroup } from './ParametersGroup'; | ||||||
| 
 | 
 | ||||||
| import { UnderlinedHeader } from '../../common-elements'; | import { UnderlinedHeader } from '../../common-elements'; | ||||||
| 
 | 
 | ||||||
|  | import { MediaContentModel } from '../../services'; | ||||||
| import { FieldModel, RequestBodyModel } from '../../services/models'; | import { FieldModel, RequestBodyModel } from '../../services/models'; | ||||||
| import { MediaTypesSwitch } from '../MediaTypeSwitch/MediaTypesSwitch'; | import { MediaTypesSwitch } from '../MediaTypeSwitch/MediaTypesSwitch'; | ||||||
| import { Schema } from '../Schema'; | import { Schema } from '../Schema'; | ||||||
| 
 | 
 | ||||||
| import { MediaContentModel } from '../../services'; | import { Markdown } from '../Markdown/Markdown'; | ||||||
| 
 | 
 | ||||||
| function safePush(obj, prop, item) { | function safePush(obj, prop, item) { | ||||||
|   if (!obj[prop]) { |   if (!obj[prop]) { | ||||||
|  | @ -45,13 +46,15 @@ export class Parameters extends React.PureComponent<ParametersProps> { | ||||||
| 
 | 
 | ||||||
|     const bodyContent = body && body.content; |     const bodyContent = body && body.content; | ||||||
| 
 | 
 | ||||||
|  |     const bodyDescription = body && body.description; | ||||||
|  | 
 | ||||||
|     return ( |     return ( | ||||||
|       <div> |       <> | ||||||
|         {paramsPlaces.map(place => ( |         {paramsPlaces.map(place => ( | ||||||
|           <ParametersGroup key={place} place={place} parameters={paramsMap[place]} /> |           <ParametersGroup key={place} place={place} parameters={paramsMap[place]} /> | ||||||
|         ))} |         ))} | ||||||
|         {bodyContent && <BodyContent content={bodyContent} />} |         {bodyContent && <BodyContent content={bodyContent} description={bodyDescription} />} | ||||||
|       </div> |       </> | ||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | @ -64,12 +67,17 @@ function DropdownWithinHeader(props) { | ||||||
|   ); |   ); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function BodyContent(props: { content: MediaContentModel }): JSX.Element { | function BodyContent(props: { content: MediaContentModel; description?: string }): JSX.Element { | ||||||
|   const { content } = props; |   const { content, description } = props; | ||||||
|   return ( |   return ( | ||||||
|     <MediaTypesSwitch content={content} renderDropdown={DropdownWithinHeader}> |     <MediaTypesSwitch content={content} renderDropdown={DropdownWithinHeader}> | ||||||
|       {({ schema }) => { |       {({ schema }) => { | ||||||
|         return <Schema skipReadOnly={true} key="schema" schema={schema} />; |         return ( | ||||||
|  |           <> | ||||||
|  |             {description !== undefined && <Markdown source={description} />} | ||||||
|  |             <Schema skipReadOnly={true} key="schema" schema={schema} /> | ||||||
|  |           </> | ||||||
|  |         ); | ||||||
|       }} |       }} | ||||||
|     </MediaTypesSwitch> |     </MediaTypesSwitch> | ||||||
|   ); |   ); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user