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