diff --git a/README.md b/README.md index 138e1661..82eeeecf 100644 --- a/README.md +++ b/README.md @@ -242,7 +242,7 @@ You can use all of the following options with standalone version on tag * `hideDownloadButton` - do not show "Download" spec button. **THIS DOESN'T MAKE YOUR SPEC PRIVATE**, it just hides the button. * `disableSearch` - disable search indexing and search box * `onlyRequiredInSamples` - shows only required fields in request samples. -* `sampleCollapseLevel` - set the collapse level in response samples. Special value 'all' expand all response. Default value = 2. +* `jsonSampleExpandLevel` - set the default expand level for JSON payload samples (responses and request body). Special value 'all' expands all levels. The default value is `2`. * `theme` - ReDoc theme. Not documented yet. For details check source code: [theme.ts](https://github.com/Redocly/redoc/blob/master/src/theme.ts) ## Advanced usage of standalone version diff --git a/src/components/JsonViewer/JsonViewer.tsx b/src/components/JsonViewer/JsonViewer.tsx index 3b213ef8..bf735299 100644 --- a/src/components/JsonViewer/JsonViewer.tsx +++ b/src/components/JsonViewer/JsonViewer.tsx @@ -40,7 +40,7 @@ class Json extends React.PureComponent { // tslint:disable-next-line ref={node => (this.node = node!)} dangerouslySetInnerHTML={{ - __html: jsonToHTML(this.props.data, options.sampleCollapseLevel), + __html: jsonToHTML(this.props.data, options.jsonSampleExpandLevel), }} /> )} diff --git a/src/services/RedocNormalizedOptions.ts b/src/services/RedocNormalizedOptions.ts index 1690b290..fe924cde 100644 --- a/src/services/RedocNormalizedOptions.ts +++ b/src/services/RedocNormalizedOptions.ts @@ -22,7 +22,7 @@ export interface RedocRawOptions { onlyRequiredInSamples?: boolean | string; showExtensions?: boolean | string | string[]; hideSingleRequestSampleTab?: boolean | string; - sampleCollapseLevel?: number | string | 'all'; + jsonSampleExpandLevel?: number | string | 'all'; unstable_ignoreMimeParameters?: boolean; @@ -136,7 +136,7 @@ export class RedocNormalizedOptions { onlyRequiredInSamples: boolean; showExtensions: boolean | string[]; hideSingleRequestSampleTab: boolean; - sampleCollapseLevel: number; + jsonSampleExpandLevel: number; /* tslint:disable-next-line */ unstable_ignoreMimeParameters: boolean; @@ -168,8 +168,8 @@ export class RedocNormalizedOptions { this.onlyRequiredInSamples = argValueToBoolean(raw.onlyRequiredInSamples); this.showExtensions = RedocNormalizedOptions.normalizeShowExtensions(raw.showExtensions); this.hideSingleRequestSampleTab = argValueToBoolean(raw.hideSingleRequestSampleTab); - this.sampleCollapseLevel = RedocNormalizedOptions.normalizeSampleCollapseLevel( - raw.sampleCollapseLevel, + this.jsonSampleExpandLevel = RedocNormalizedOptions.normalizeSampleCollapseLevel( + raw.jsonSampleExpandLevel, ); this.unstable_ignoreMimeParameters = argValueToBoolean(raw.unstable_ignoreMimeParameters);