add showReadOnly and showWriteOnly options to object-description

This commit is contained in:
Dimitar Nanov 2018-11-14 16:13:07 +02:00 committed by Roman Hotsiy
parent a8f70377ab
commit 6935b16964
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -9,6 +9,8 @@ import { MediaTypeSamples } from '../PayloadSamples/MediaTypeSamples';
export interface ObjectDescriptionProps {
schemaRef: string;
examplesRef?: string;
showReadOnly?: boolean;
showWriteOnly?: boolean;
parser: OpenAPIParser;
options: RedocNormalizedOptions;
}
@ -53,11 +55,18 @@ export class ObjectDescription extends React.PureComponent<ObjectDescriptionProp
}
render() {
const { showReadOnly = true, showWriteOnly = false } = this.props;
console.log(this.props);
return (
<Section>
<Row>
<MiddlePanel>
<Schema skipWriteOnly={true} key="schema" schema={this.mediaModel.schema} />
<Schema
skipWriteOnly={!showWriteOnly}
skipReadOnly={!showReadOnly}
key="schema"
schema={this.mediaModel.schema}
/>
</MiddlePanel>
<DarkRightPanel>
<MediaTypeSamples mediaType={this.mediaModel} />