mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-10 19:06:34 +03:00
fix: hideRequestPayloadSample (#2436)
This commit is contained in:
parent
b36a6e27bb
commit
bf960612a4
|
@ -87,6 +87,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"hideDownloadButton": false,
|
"hideDownloadButton": false,
|
||||||
"hideFab": false,
|
"hideFab": false,
|
||||||
"hideHostname": false,
|
"hideHostname": false,
|
||||||
|
"hideRequestPayloadSample": false,
|
||||||
"hideSchemaPattern": false,
|
"hideSchemaPattern": false,
|
||||||
"hideSchemaTitles": false,
|
"hideSchemaTitles": false,
|
||||||
"hideSecuritySection": false,
|
"hideSecuritySection": false,
|
||||||
|
@ -358,6 +359,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"hideDownloadButton": false,
|
"hideDownloadButton": false,
|
||||||
"hideFab": false,
|
"hideFab": false,
|
||||||
"hideHostname": false,
|
"hideHostname": false,
|
||||||
|
"hideRequestPayloadSample": false,
|
||||||
"hideSchemaPattern": false,
|
"hideSchemaPattern": false,
|
||||||
"hideSchemaTitles": false,
|
"hideSchemaTitles": false,
|
||||||
"hideSecuritySection": false,
|
"hideSecuritySection": false,
|
||||||
|
@ -616,6 +618,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"hideDownloadButton": false,
|
"hideDownloadButton": false,
|
||||||
"hideFab": false,
|
"hideFab": false,
|
||||||
"hideHostname": false,
|
"hideHostname": false,
|
||||||
|
"hideRequestPayloadSample": false,
|
||||||
"hideSchemaPattern": false,
|
"hideSchemaPattern": false,
|
||||||
"hideSchemaTitles": false,
|
"hideSchemaTitles": false,
|
||||||
"hideSecuritySection": false,
|
"hideSecuritySection": false,
|
||||||
|
@ -936,6 +939,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"hideDownloadButton": false,
|
"hideDownloadButton": false,
|
||||||
"hideFab": false,
|
"hideFab": false,
|
||||||
"hideHostname": false,
|
"hideHostname": false,
|
||||||
|
"hideRequestPayloadSample": false,
|
||||||
"hideSchemaPattern": false,
|
"hideSchemaPattern": false,
|
||||||
"hideSchemaTitles": false,
|
"hideSchemaTitles": false,
|
||||||
"hideSecuritySection": false,
|
"hideSecuritySection": false,
|
||||||
|
@ -1219,6 +1223,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"hideDownloadButton": false,
|
"hideDownloadButton": false,
|
||||||
"hideFab": false,
|
"hideFab": false,
|
||||||
"hideHostname": false,
|
"hideHostname": false,
|
||||||
|
"hideRequestPayloadSample": false,
|
||||||
"hideSchemaPattern": false,
|
"hideSchemaPattern": false,
|
||||||
"hideSchemaTitles": false,
|
"hideSchemaTitles": false,
|
||||||
"hideSecuritySection": false,
|
"hideSecuritySection": false,
|
||||||
|
@ -1473,6 +1478,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"hideDownloadButton": false,
|
"hideDownloadButton": false,
|
||||||
"hideFab": false,
|
"hideFab": false,
|
||||||
"hideHostname": false,
|
"hideHostname": false,
|
||||||
|
"hideRequestPayloadSample": false,
|
||||||
"hideSchemaPattern": false,
|
"hideSchemaPattern": false,
|
||||||
"hideSchemaTitles": false,
|
"hideSchemaTitles": false,
|
||||||
"hideSecuritySection": false,
|
"hideSecuritySection": false,
|
||||||
|
@ -1752,6 +1758,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"hideDownloadButton": false,
|
"hideDownloadButton": false,
|
||||||
"hideFab": false,
|
"hideFab": false,
|
||||||
"hideHostname": false,
|
"hideHostname": false,
|
||||||
|
"hideRequestPayloadSample": false,
|
||||||
"hideSchemaPattern": false,
|
"hideSchemaPattern": false,
|
||||||
"hideSchemaTitles": false,
|
"hideSchemaTitles": false,
|
||||||
"hideSecuritySection": false,
|
"hideSecuritySection": false,
|
||||||
|
@ -2061,6 +2068,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"hideDownloadButton": false,
|
"hideDownloadButton": false,
|
||||||
"hideFab": false,
|
"hideFab": false,
|
||||||
"hideHostname": false,
|
"hideHostname": false,
|
||||||
|
"hideRequestPayloadSample": false,
|
||||||
"hideSchemaPattern": false,
|
"hideSchemaPattern": false,
|
||||||
"hideSchemaTitles": false,
|
"hideSchemaTitles": false,
|
||||||
"hideSecuritySection": false,
|
"hideSecuritySection": false,
|
||||||
|
@ -2332,6 +2340,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"hideDownloadButton": false,
|
"hideDownloadButton": false,
|
||||||
"hideFab": false,
|
"hideFab": false,
|
||||||
"hideHostname": false,
|
"hideHostname": false,
|
||||||
|
"hideRequestPayloadSample": false,
|
||||||
"hideSchemaPattern": false,
|
"hideSchemaPattern": false,
|
||||||
"hideSchemaTitles": false,
|
"hideSchemaTitles": false,
|
||||||
"hideSecuritySection": false,
|
"hideSecuritySection": false,
|
||||||
|
@ -2590,6 +2599,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"hideDownloadButton": false,
|
"hideDownloadButton": false,
|
||||||
"hideFab": false,
|
"hideFab": false,
|
||||||
"hideHostname": false,
|
"hideHostname": false,
|
||||||
|
"hideRequestPayloadSample": false,
|
||||||
"hideSchemaPattern": false,
|
"hideSchemaPattern": false,
|
||||||
"hideSchemaTitles": false,
|
"hideSchemaTitles": false,
|
||||||
"hideSecuritySection": false,
|
"hideSecuritySection": false,
|
||||||
|
|
|
@ -28,6 +28,7 @@ export interface RedocRawOptions {
|
||||||
showExtensions?: boolean | string | string[];
|
showExtensions?: boolean | string | string[];
|
||||||
sideNavStyle?: SideNavStyleEnum;
|
sideNavStyle?: SideNavStyleEnum;
|
||||||
hideSingleRequestSampleTab?: boolean | string;
|
hideSingleRequestSampleTab?: boolean | string;
|
||||||
|
hideRequestPayloadSample?: boolean;
|
||||||
menuToggle?: boolean | string;
|
menuToggle?: boolean | string;
|
||||||
jsonSampleExpandLevel?: number | string | 'all';
|
jsonSampleExpandLevel?: number | string | 'all';
|
||||||
hideSchemaTitles?: boolean | string;
|
hideSchemaTitles?: boolean | string;
|
||||||
|
@ -231,6 +232,7 @@ export class RedocNormalizedOptions {
|
||||||
showExtensions: boolean | string[];
|
showExtensions: boolean | string[];
|
||||||
sideNavStyle: SideNavStyleEnum;
|
sideNavStyle: SideNavStyleEnum;
|
||||||
hideSingleRequestSampleTab: boolean;
|
hideSingleRequestSampleTab: boolean;
|
||||||
|
hideRequestPayloadSample: boolean;
|
||||||
menuToggle: boolean;
|
menuToggle: boolean;
|
||||||
jsonSampleExpandLevel: number;
|
jsonSampleExpandLevel: number;
|
||||||
enumSkipQuotes: boolean;
|
enumSkipQuotes: boolean;
|
||||||
|
@ -302,6 +304,7 @@ export class RedocNormalizedOptions {
|
||||||
this.showExtensions = RedocNormalizedOptions.normalizeShowExtensions(raw.showExtensions);
|
this.showExtensions = RedocNormalizedOptions.normalizeShowExtensions(raw.showExtensions);
|
||||||
this.sideNavStyle = RedocNormalizedOptions.normalizeSideNavStyle(raw.sideNavStyle);
|
this.sideNavStyle = RedocNormalizedOptions.normalizeSideNavStyle(raw.sideNavStyle);
|
||||||
this.hideSingleRequestSampleTab = argValueToBoolean(raw.hideSingleRequestSampleTab);
|
this.hideSingleRequestSampleTab = argValueToBoolean(raw.hideSingleRequestSampleTab);
|
||||||
|
this.hideRequestPayloadSample = argValueToBoolean(raw.hideRequestPayloadSample);
|
||||||
this.menuToggle = argValueToBoolean(raw.menuToggle, true);
|
this.menuToggle = argValueToBoolean(raw.menuToggle, true);
|
||||||
this.jsonSampleExpandLevel = RedocNormalizedOptions.normalizeJsonSampleExpandLevel(
|
this.jsonSampleExpandLevel = RedocNormalizedOptions.normalizeJsonSampleExpandLevel(
|
||||||
raw.jsonSampleExpandLevel,
|
raw.jsonSampleExpandLevel,
|
||||||
|
|
|
@ -195,6 +195,7 @@ export class OperationModel implements IMenuItem {
|
||||||
|
|
||||||
@memoize
|
@memoize
|
||||||
get codeSamples() {
|
get codeSamples() {
|
||||||
|
const { payloadSampleIdx, hideRequestPayloadSample } = this.options;
|
||||||
let samples: Array<OpenAPIXCodeSample | XPayloadSample> =
|
let samples: Array<OpenAPIXCodeSample | XPayloadSample> =
|
||||||
this.operationSpec['x-codeSamples'] || this.operationSpec['x-code-samples'] || [];
|
this.operationSpec['x-codeSamples'] || this.operationSpec['x-code-samples'] || [];
|
||||||
|
|
||||||
|
@ -204,8 +205,8 @@ export class OperationModel implements IMenuItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
const requestBodyContent = this.requestBody && this.requestBody.content;
|
const requestBodyContent = this.requestBody && this.requestBody.content;
|
||||||
if (requestBodyContent && requestBodyContent.hasSample) {
|
if (requestBodyContent && requestBodyContent.hasSample && !hideRequestPayloadSample) {
|
||||||
const insertInx = Math.min(samples.length, this.options.payloadSampleIdx);
|
const insertInx = Math.min(samples.length, payloadSampleIdx);
|
||||||
|
|
||||||
samples = [
|
samples = [
|
||||||
...samples.slice(0, insertInx),
|
...samples.slice(0, insertInx),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user