redoc 2.3.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redoc",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "description": "ReDoc",
5
5
  "repository": {
6
6
  "type": "git",
@@ -93,7 +93,7 @@
93
93
  "cypress": "^13.8.1",
94
94
  "enzyme": "^3.11.0",
95
95
  "enzyme-to-json": "^3.6.2",
96
- "esbuild-loader": "^3.0.1",
96
+ "esbuild-loader": "^4.3.0",
97
97
  "eslint": "^7.27.0",
98
98
  "eslint-plugin-import": "^2.23.4",
99
99
  "eslint-plugin-react": "^7.34.2",
@@ -133,15 +133,15 @@
133
133
  "peerDependencies": {
134
134
  "core-js": "^3.1.4",
135
135
  "mobx": "^6.0.4",
136
- "react": "^16.8.4 || ^17.0.0 || ^18.0.0",
137
- "react-dom": "^16.8.4 || ^17.0.0 || ^18.0.0",
136
+ "react": "^16.8.4 || ^17.0.0 || ^18.0.0 || ^19.0.0",
137
+ "react-dom": "^16.8.4 || ^17.0.0 || ^18.0.0 || ^19.0.0",
138
138
  "styled-components": "^4.1.1 || ^5.1.1 || ^6.0.5"
139
139
  },
140
140
  "dependencies": {
141
141
  "@redocly/openapi-core": "^1.4.0",
142
142
  "classnames": "^2.3.2",
143
143
  "decko": "^1.2.0",
144
- "dompurify": "^3.0.6",
144
+ "dompurify": "^3.2.4",
145
145
  "eventemitter3": "^5.0.1",
146
146
  "json-pointer": "^0.6.2",
147
147
  "lunr": "^2.3.9",
@@ -4,6 +4,5 @@ export interface ApiInfoProps {
4
4
  store: AppStore;
5
5
  }
6
6
  export declare class ApiInfo extends React.Component<ApiInfoProps> {
7
- handleDownloadClick: (e: any) => void;
8
7
  render(): React.JSX.Element;
9
8
  }
@@ -1,12 +1,15 @@
1
1
  import * as React from 'react';
2
2
  export interface EnumValuesProps {
3
- values: string[];
4
- isArrayType: boolean;
3
+ values?: string[] | {
4
+ [name: string]: string;
5
+ };
6
+ type: string | string[];
5
7
  }
6
8
  export interface EnumValuesState {
7
9
  collapsed: boolean;
8
10
  }
9
11
  export declare class EnumValues extends React.PureComponent<EnumValuesProps, EnumValuesState> {
12
+ constructor(props: EnumValuesProps);
10
13
  state: EnumValuesState;
11
14
  static contextType: React.Context<import("../../services/RedocNormalizedOptions").RedocNormalizedOptions>;
12
15
  private toggle;
@@ -1,15 +1,19 @@
1
1
  import * as React from 'react';
2
2
  import type { SchemaOptions } from '../Schema/Schema';
3
3
  import type { FieldModel } from '../../services/models';
4
+ import { RedocNormalizedOptions } from '../../services/RedocNormalizedOptions';
4
5
  export interface FieldProps extends SchemaOptions {
5
6
  className?: string;
6
7
  isLast?: boolean;
7
8
  showExamples?: boolean;
8
9
  field: FieldModel;
9
10
  expandByDefault?: boolean;
11
+ fieldParentsName?: string[];
10
12
  renderDiscriminatorSwitch?: (opts: FieldProps) => JSX.Element;
11
13
  }
12
14
  export declare class Field extends React.Component<FieldProps> {
15
+ static contextType: React.Context<RedocNormalizedOptions>;
16
+ context: RedocNormalizedOptions;
13
17
  toggle: () => void;
14
18
  handleKeyPress: (e: any) => void;
15
19
  render(): React.JSX.Element;
@@ -6,5 +6,6 @@ export interface ObjectSchemaProps extends SchemaProps {
6
6
  fieldName: string;
7
7
  parentSchema: SchemaModel;
8
8
  };
9
+ fieldParentsName?: string[];
9
10
  }
10
- export declare const ObjectSchema: ({ schema: { fields, title }, showTitle, discriminator, skipReadOnly, skipWriteOnly, level, }: ObjectSchemaProps) => React.JSX.Element;
11
+ export declare const ObjectSchema: ({ schema: { fields, title }, showTitle, discriminator, skipReadOnly, skipWriteOnly, level, fieldParentsName, }: ObjectSchemaProps) => React.JSX.Element;
@@ -8,6 +8,7 @@ export interface SchemaOptions {
8
8
  }
9
9
  export interface SchemaProps extends SchemaOptions {
10
10
  schema: SchemaModel;
11
+ fieldParentsName?: string[];
11
12
  }
12
13
  export declare class Schema extends React.Component<Partial<SchemaProps>> {
13
14
  render(): React.JSX.Element | null;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { OperationModel } from '../../services';
3
2
  import type { IMenuItem } from '../../services';
3
+ import { OperationModel } from '../../services';
4
4
  export interface MenuItemProps {
5
5
  item: IMenuItem;
6
6
  onActivate?: (item: IMenuItem) => void;
@@ -1,4 +1,4 @@
1
- import type { OpenAPISpec } from '../types';
1
+ import type { OpenAPITag } from '../types';
2
2
  import { GroupModel, OperationModel } from './models';
3
3
  import type { OpenAPIParser } from './OpenAPIParser';
4
4
  import type { RedocNormalizedOptions } from './RedocNormalizedOptions';
@@ -40,10 +40,11 @@ export declare class MenuBuilder {
40
40
  /**
41
41
  * collects tags and maps each tag to list of operations belonging to this tag
42
42
  */
43
- static getTagsWithOperations(parser: OpenAPIParser, spec: OpenAPISpec): TagsInfoMap;
44
- static getTagRelatedSchema({ parser, tag, parent, }: {
43
+ static getTagsWithOperations(parser: OpenAPIParser, explicitTags: OpenAPITag[]): TagsInfoMap;
44
+ static getTagRelatedSchema({ parser, tag, parent, schemaDefinitionsTagName, }: {
45
45
  parser: OpenAPIParser;
46
46
  tag: TagInfo;
47
47
  parent: GroupModel;
48
+ schemaDefinitionsTagName?: string;
48
49
  }): GroupModel[];
49
50
  }
@@ -1,12 +1,17 @@
1
1
  import { ResolvedThemeInterface, ThemeInterface } from '../theme';
2
2
  import { SideNavStyleEnum } from './types';
3
3
  import type { LabelsConfigRaw, MDXComponentMeta } from './types';
4
+ export type DownloadUrlsConfig = {
5
+ title?: string;
6
+ url: string;
7
+ }[];
4
8
  export interface RedocRawOptions {
5
9
  theme?: ThemeInterface;
6
10
  scrollYOffset?: number | string | (() => number);
7
11
  hideHostname?: boolean | string;
8
12
  expandResponses?: string | 'all';
9
13
  requiredPropsFirst?: boolean | string;
14
+ sortRequiredPropsFirst?: boolean | string;
10
15
  sortPropsAlphabetically?: boolean | string;
11
16
  sortEnumValuesAlphabetically?: boolean | string;
12
17
  sortOperationsAlphabetically?: boolean | string;
@@ -14,10 +19,13 @@ export interface RedocRawOptions {
14
19
  nativeScrollbars?: boolean | string;
15
20
  pathInMiddlePanel?: boolean | string;
16
21
  untrustedSpec?: boolean | string;
22
+ sanitize?: boolean | string;
17
23
  hideLoading?: boolean | string;
18
24
  hideDownloadButton?: boolean | string;
25
+ hideDownloadButtons?: boolean | string;
19
26
  downloadFileName?: string;
20
27
  downloadDefinitionUrl?: string;
28
+ downloadUrls?: DownloadUrlsConfig;
21
29
  disableSearch?: boolean | string;
22
30
  onlyRequiredInSamples?: boolean | string;
23
31
  showExtensions?: boolean | string | string[];
@@ -26,11 +34,14 @@ export interface RedocRawOptions {
26
34
  hideRequestPayloadSample?: boolean;
27
35
  menuToggle?: boolean | string;
28
36
  jsonSampleExpandLevel?: number | string | 'all';
37
+ jsonSamplesExpandLevel?: number | string | 'all';
29
38
  hideSchemaTitles?: boolean | string;
30
39
  simpleOneOfTypeLabel?: boolean | string;
31
40
  payloadSampleIdx?: number;
32
41
  expandSingleSchemaField?: boolean | string;
33
42
  schemaExpansionLevel?: number | string | 'all';
43
+ schemasExpansionLevel?: number | string | 'all';
44
+ schemaDefinitionsTagName?: string;
34
45
  showObjectSchemaExamples?: boolean | string;
35
46
  showSecuritySchemeType?: boolean;
36
47
  hideSecuritySection?: boolean;
@@ -43,10 +54,12 @@ export interface RedocRawOptions {
43
54
  ignoreNamedSchemas?: string[] | string;
44
55
  hideSchemaPattern?: boolean;
45
56
  generatedPayloadSamplesMaxDepth?: number;
57
+ generatedSamplesMaxDepth?: number;
46
58
  nonce?: string;
47
59
  hideFab?: boolean;
48
60
  minCharacterLengthToInitSearch?: number;
49
61
  showWebhookVerb?: boolean;
62
+ hidePropertiesPrefix?: boolean;
50
63
  }
51
64
  export declare function argValueToBoolean(val?: string | boolean, defaultValue?: boolean): boolean;
52
65
  export declare class RedocNormalizedOptions {
@@ -64,17 +77,18 @@ export declare class RedocNormalizedOptions {
64
77
  expandResponses: {
65
78
  [code: string]: boolean;
66
79
  } | 'all';
67
- requiredPropsFirst: boolean;
80
+ sortRequiredPropsFirst: boolean;
68
81
  sortPropsAlphabetically: boolean;
69
82
  sortEnumValuesAlphabetically: boolean;
70
83
  sortOperationsAlphabetically: boolean;
71
84
  sortTagsAlphabetically: boolean;
72
85
  nativeScrollbars: boolean;
73
86
  pathInMiddlePanel: boolean;
74
- untrustedSpec: boolean;
75
- hideDownloadButton: boolean;
87
+ sanitize: boolean;
88
+ hideDownloadButtons: boolean;
76
89
  downloadFileName?: string;
77
90
  downloadDefinitionUrl?: string;
91
+ downloadUrls?: DownloadUrlsConfig;
78
92
  disableSearch: boolean;
79
93
  onlyRequiredInSamples: boolean;
80
94
  showExtensions: boolean | string[];
@@ -82,13 +96,14 @@ export declare class RedocNormalizedOptions {
82
96
  hideSingleRequestSampleTab: boolean;
83
97
  hideRequestPayloadSample: boolean;
84
98
  menuToggle: boolean;
85
- jsonSampleExpandLevel: number;
99
+ jsonSamplesExpandLevel: number;
86
100
  enumSkipQuotes: boolean;
87
101
  hideSchemaTitles: boolean;
88
102
  simpleOneOfTypeLabel: boolean;
89
103
  payloadSampleIdx: number;
90
104
  expandSingleSchemaField: boolean;
91
- schemaExpansionLevel: number;
105
+ schemasExpansionLevel: number;
106
+ schemaDefinitionsTagName?: string;
92
107
  showObjectSchemaExamples: boolean;
93
108
  showSecuritySchemeType?: boolean;
94
109
  hideSecuritySection?: boolean;
@@ -98,10 +113,11 @@ export declare class RedocNormalizedOptions {
98
113
  maxDisplayedEnumValues?: number;
99
114
  ignoreNamedSchemas: Set<string>;
100
115
  hideSchemaPattern: boolean;
101
- generatedPayloadSamplesMaxDepth: number;
116
+ generatedSamplesMaxDepth: number;
102
117
  hideFab: boolean;
103
118
  minCharacterLengthToInitSearch: number;
104
119
  showWebhookVerb: boolean;
120
+ hidePropertiesPrefix?: boolean;
105
121
  nonce?: string;
106
122
  constructor(raw: RedocRawOptions, defaults?: RedocRawOptions);
107
123
  }
@@ -11,9 +11,13 @@ export declare class ApiInfoModel implements OpenAPIInfo {
11
11
  termsOfService?: string;
12
12
  contact?: OpenAPIContact;
13
13
  license?: OpenAPILicense;
14
- downloadLink?: string;
14
+ downloadUrls: {
15
+ title?: string;
16
+ url?: string;
17
+ }[];
15
18
  downloadFileName?: string;
16
19
  constructor(parser: OpenAPIParser, options?: RedocNormalizedOptions);
20
+ private getDownloadUrls;
17
21
  private getDownloadLink;
18
22
  private getDownloadFileName;
19
23
  }
@@ -11,7 +11,7 @@ export declare class MediaTypeModel {
11
11
  name: string;
12
12
  isRequestType: boolean;
13
13
  onlyRequiredInSamples: boolean;
14
- generatedPayloadSamplesMaxDepth: number;
14
+ generatedSamplesMaxDepth: number;
15
15
  /**
16
16
  * @param isRequestType needed to know if skipe RO/RW fields in objects
17
17
  */
@@ -36,6 +36,9 @@ export declare class SchemaModel {
36
36
  rawSchema: OpenAPISchema;
37
37
  schema: MergedOpenAPISchema;
38
38
  extensions?: Record<string, any>;
39
+ 'x-enumDescriptions': {
40
+ [name: string]: string;
41
+ };
39
42
  const: any;
40
43
  contentEncoding?: string;
41
44
  contentMediaType?: string;