mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-10 19:06:34 +03:00
Allow showing SchemaDefinition as child
This commit is contained in:
parent
31d88a184b
commit
88e7d72d56
|
@ -15,6 +15,7 @@ export interface ObjectDescriptionProps {
|
|||
showReadOnly?: boolean;
|
||||
showWriteOnly?: boolean;
|
||||
showExample?: boolean;
|
||||
showAsChild?: boolean;
|
||||
parser: OpenAPIParser;
|
||||
options: RedocNormalizedOptions;
|
||||
}
|
||||
|
@ -39,15 +40,10 @@ export class SchemaDefinition extends React.PureComponent<ObjectDescriptionProps
|
|||
private _mediaModel: MediaTypeModel;
|
||||
|
||||
private get mediaModel() {
|
||||
const { parser, schemaRef, exampleRef, options } = this.props;
|
||||
const { parser, schemaRef, exampleRef, options, showAsChild } = this.props;
|
||||
if (!this._mediaModel) {
|
||||
this._mediaModel = new MediaTypeModel(
|
||||
parser,
|
||||
'json',
|
||||
false,
|
||||
SchemaDefinition.getMediaType(schemaRef, exampleRef),
|
||||
options,
|
||||
);
|
||||
const info = SchemaDefinition.getMediaType(schemaRef, exampleRef);
|
||||
this._mediaModel = new MediaTypeModel(parser, 'json', false, info, options, showAsChild);
|
||||
}
|
||||
|
||||
return this._mediaModel;
|
||||
|
|
|
@ -25,10 +25,11 @@ export class MediaTypeModel {
|
|||
isRequestType: boolean,
|
||||
info: OpenAPIMediaType,
|
||||
options: RedocNormalizedOptions,
|
||||
showAsChild?: boolean,
|
||||
) {
|
||||
this.name = name;
|
||||
this.isRequestType = isRequestType;
|
||||
this.schema = info.schema && new SchemaModel(parser, info.schema, '', options);
|
||||
this.schema = info.schema && new SchemaModel(parser, info.schema, '', options, showAsChild);
|
||||
this.onlyRequiredInSamples = options.onlyRequiredInSamples;
|
||||
this.generatedPayloadSamplesMaxDepth = options.generatedPayloadSamplesMaxDepth;
|
||||
if (info.examples !== undefined) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user