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