redoc 2.2.0 → 2.4.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.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "ReDoc",
5
5
  "repository": {
6
6
  "type": "git",
@@ -61,6 +61,7 @@
61
61
  "pre-commit": "pretty-quick --staged && npm run lint"
62
62
  },
63
63
  "devDependencies": {
64
+ "@cfaester/enzyme-adapter-react-18": "^0.8.0",
64
65
  "@cypress/webpack-preprocessor": "^5.17.1",
65
66
  "@size-limit/file": "^11.1.4",
66
67
  "@types/chai": "^4.2.18",
@@ -123,7 +124,7 @@
123
124
  "typescript": "^4.9.0",
124
125
  "unfetch": "^4.2.0",
125
126
  "url": "^0.11.1",
126
- "webpack": "^5.88.2",
127
+ "webpack": "^5.94.0",
127
128
  "webpack-cli": "^5.1.4",
128
129
  "webpack-dev-server": "^4.15.1",
129
130
  "webpack-node-externals": "^3.0.0",
@@ -132,12 +133,11 @@
132
133
  "peerDependencies": {
133
134
  "core-js": "^3.1.4",
134
135
  "mobx": "^6.0.4",
135
- "react": "^16.8.4 || ^17.0.0 || ^18.0.0",
136
- "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",
137
138
  "styled-components": "^4.1.1 || ^5.1.1 || ^6.0.5"
138
139
  },
139
140
  "dependencies": {
140
- "@cfaester/enzyme-adapter-react-18": "^0.8.0",
141
141
  "@redocly/openapi-core": "^1.4.0",
142
142
  "classnames": "^2.3.2",
143
143
  "decko": "^1.2.0",
@@ -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,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;
@@ -17,7 +17,7 @@ export declare function serializeParameterValueWithMime(value: any, mime: string
17
17
  export declare function serializeParameterValue(parameter: (OpenAPIParameter & {
18
18
  serializationMime?: string;
19
19
  }) | FieldModel, value: any): string;
20
- export declare function getSerializedValue(field: FieldModel, example: any): string;
20
+ export declare function getSerializedValue(field: FieldModel, example: any): any;
21
21
  export declare function langFromMime(contentType: string): string;
22
22
  export declare function isNamedDefinition(pointer?: string): boolean;
23
23
  export declare function getDefinitionName(pointer?: string): string | undefined;