mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-10-30 23:37:28 +03:00 
			
		
		
		
	bundle and test
This commit is contained in:
		
							parent
							
								
									4359724434
								
							
						
					
					
						commit
						ffb70d2db2
					
				|  | @ -1,10 +1,10 @@ | |||
| import * as React from 'react'; | ||||
| import { Schema } from '../Schema'; | ||||
| 
 | ||||
| import { MiddlePanel, Row, Section, DarkRightPanel } from '../../common-elements'; | ||||
| import { OpenAPIParser, RedocNormalizedOptions, MediaTypeModel } from '../../services'; | ||||
| import { MediaTypeSamples } from '../PayloadSamples/MediaTypeSamples'; | ||||
| import { DarkRightPanel, MiddlePanel, Row, Section } from '../../common-elements'; | ||||
| import { MediaTypeModel, OpenAPIParser, RedocNormalizedOptions } from '../../services'; | ||||
| import { OpenAPIMediaType } from '../../types'; | ||||
| import { MediaTypeSamples } from '../PayloadSamples/MediaTypeSamples'; | ||||
| 
 | ||||
| export interface ObjectDescriptionProps { | ||||
|   schemaRef: string; | ||||
|  | @ -14,6 +14,37 @@ export interface ObjectDescriptionProps { | |||
| } | ||||
| 
 | ||||
| export class ObjectDescription extends React.PureComponent<ObjectDescriptionProps> { | ||||
|   private static getMediaType(schemaRef, examplesRef): OpenAPIMediaType { | ||||
|     if (!schemaRef) { | ||||
|       return {}; | ||||
|     } | ||||
| 
 | ||||
|     const info: OpenAPIMediaType = { | ||||
|       schema: { $ref: schemaRef }, | ||||
|     }; | ||||
| 
 | ||||
|     if (examplesRef) { | ||||
|       info.examples = { object: { $ref: examplesRef } }; | ||||
|     } | ||||
| 
 | ||||
|     return info; | ||||
|   } | ||||
| 
 | ||||
|   private static getMediaModel({ | ||||
|     schemaRef, | ||||
|     examplesRef, | ||||
|     parser, | ||||
|     options, | ||||
|   }: ObjectDescriptionProps) { | ||||
|     return new MediaTypeModel( | ||||
|       parser, | ||||
|       'json', | ||||
|       false, | ||||
|       ObjectDescription.getMediaType(schemaRef, examplesRef), | ||||
|       options, | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   private mediaModel: MediaTypeModel; | ||||
| 
 | ||||
|   constructor(props: ObjectDescriptionProps) { | ||||
|  | @ -35,30 +66,4 @@ export class ObjectDescription extends React.PureComponent<ObjectDescriptionProp | |||
|       </Section> | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   private static getMediaType(schemaRef, examplesRef): OpenAPIMediaType { | ||||
|     if (!schemaRef) return {}; | ||||
| 
 | ||||
|     const info: OpenAPIMediaType = { | ||||
|       schema: { $ref: schemaRef }, | ||||
|     }; | ||||
| 
 | ||||
|     if (examplesRef) info.examples = { object: { $ref: examplesRef } }; | ||||
|     return info; | ||||
|   } | ||||
| 
 | ||||
|   private static getMediaModel({ | ||||
|     schemaRef, | ||||
|     examplesRef, | ||||
|     parser, | ||||
|     options, | ||||
|   }: ObjectDescriptionProps) { | ||||
|     return new MediaTypeModel( | ||||
|       parser, | ||||
|       'json', | ||||
|       false, | ||||
|       ObjectDescription.getMediaType(schemaRef, examplesRef), | ||||
|       options, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -13,8 +13,8 @@ import { SearchStore } from './SearchStore'; | |||
| import { ObjectDescription } from '../components/ObjectDescription/ObjectDescription'; | ||||
| import { SecurityDefs } from '../components/SecuritySchemes/SecuritySchemes'; | ||||
| import { | ||||
|   SECURITY_DEFINITIONS_COMPONENT_NAME, | ||||
|   OBJECT_DEFINTION_COMPONENT_NAME, | ||||
|   SECURITY_DEFINITIONS_COMPONENT_NAME, | ||||
| } from '../utils/openapi'; | ||||
| 
 | ||||
| export interface StoreState { | ||||
|  |  | |||
|  | @ -59,7 +59,7 @@ export class MenuBuilder { | |||
|    */ | ||||
|   static addMarkdownItems( | ||||
|     description: string, | ||||
|     parent: GroupModel | undefined, | ||||
|     grandparent: GroupModel | undefined, | ||||
|     options: RedocNormalizedOptions, | ||||
|   ): ContentItemModel[] { | ||||
|     const renderer = new MarkdownRenderer(options); | ||||
|  | @ -83,7 +83,7 @@ export class MenuBuilder { | |||
|         return group; | ||||
|       }); | ||||
| 
 | ||||
|     return mapHeadingsDeep(parent, headings, 1); | ||||
|     return mapHeadingsDeep(grandparent, headings, 1); | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user