@redocly/openapi-core 1.27.1 → 1.28.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/CHANGELOG.md +18 -0
- package/lib/index.d.ts +1 -1
- package/lib/redocly/registry-api.js +6 -2
- package/lib/rules/oas3/array-parameter-serialization.js +3 -4
- package/lib/types/arazzo.js +1 -1
- package/lib/types/oas3_1.js +2 -0
- package/lib/types/redocly-yaml.js +1 -1
- package/lib/typings/arazzo.d.ts +1 -1
- package/lib/typings/openapi.d.ts +118 -66
- package/lib/utils.d.ts +3 -0
- package/lib/utils.js +1 -2
- package/lib/visitors.d.ts +22 -22
- package/package.json +5 -9
- package/src/__tests__/lint.test.ts +105 -10
- package/src/decorators/oas3/remove-unused-components.ts +16 -4
- package/src/index.ts +1 -1
- package/src/redocly/__tests__/redocly-client.test.ts +14 -6
- package/src/redocly/registry-api.ts +7 -6
- package/src/rules/common/operation-tag-defined.ts +2 -2
- package/src/rules/common/security-defined.ts +2 -1
- package/src/rules/common/tags-alphabetical.ts +5 -2
- package/src/rules/oas3/array-parameter-serialization.ts +9 -6
- package/src/rules/oas3/component-name-unique.ts +4 -2
- package/src/types/arazzo.ts +1 -1
- package/src/types/oas3_1.ts +2 -0
- package/src/types/redocly-yaml.ts +1 -1
- package/src/typings/arazzo.ts +1 -1
- package/src/typings/openapi.ts +115 -71
- package/src/utils.ts +2 -1
- package/src/visitors.ts +26 -21
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @redocly/openapi-core
|
|
2
2
|
|
|
3
|
+
## 1.28.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Switched to using native `fetch` API instead of `node-fetch` dependency, improving performance and reducing bundle size.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Removed support for `in: body` parameters due to Arazzo specification updates.
|
|
12
|
+
- Updated typings for OAS 3.0 and OAS 3.1 Schemas.
|
|
13
|
+
|
|
14
|
+
## 1.27.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated the `sideNavStyle` configuration schema to include the `path-only` option.
|
|
19
|
+
- Updated @redocly/config to v0.20.1.
|
|
20
|
+
|
|
3
21
|
## 1.27.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { Oas2Types } from './types/oas2';
|
|
|
6
6
|
export { AsyncApi2Types } from './types/asyncapi2';
|
|
7
7
|
export { AsyncApi3Types } from './types/asyncapi3';
|
|
8
8
|
export { ConfigTypes } from './types/redocly-yaml';
|
|
9
|
-
export type { Oas3Definition, Oas3_1Definition, Oas3Components, Oas3PathItem, Oas3Paths, Oas3ComponentName, Oas3Schema, Oas3_1Schema, Oas3Tag,
|
|
9
|
+
export type { Oas3Definition, Oas3_1Definition, Oas3Components, Oas3_1Components, Oas3PathItem, Oas3Paths, Oas3ComponentName, Oas3Schema, Oas3_1Schema, Oas3Tag, Referenced, OasRef, } from './typings/openapi';
|
|
10
10
|
export type { Oas2Definition } from './typings/swagger';
|
|
11
11
|
export type { StatsAccumulator, StatsName } from './typings/common';
|
|
12
12
|
export { normalizeTypes } from './types';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RegistryApi = void 0;
|
|
4
|
-
const node_fetch_1 = require("node-fetch");
|
|
5
4
|
const utils_1 = require("../utils");
|
|
6
5
|
const domains_1 = require("./domains");
|
|
7
6
|
const version = require('../../package.json').version;
|
|
@@ -30,7 +29,12 @@ class RegistryApi {
|
|
|
30
29
|
if (!headers.hasOwnProperty('authorization')) {
|
|
31
30
|
throw new Error('Unauthorized');
|
|
32
31
|
}
|
|
33
|
-
const
|
|
32
|
+
const requestOptions = {
|
|
33
|
+
...options,
|
|
34
|
+
headers,
|
|
35
|
+
agent: (0, utils_1.getProxyAgent)(),
|
|
36
|
+
};
|
|
37
|
+
const response = await fetch(`${this.getBaseUrl()}${path}`, requestOptions);
|
|
34
38
|
if (response.status === 401) {
|
|
35
39
|
throw new Error('Unauthorized');
|
|
36
40
|
}
|
|
@@ -9,10 +9,9 @@ const ArrayParameterSerialization = (options) => {
|
|
|
9
9
|
if (!node.schema) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
-
const schema = (0, ref_utils_1.isRef)(node.schema)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (schema && shouldReportMissingStyleAndExplode(node, schema, options)) {
|
|
12
|
+
const schema = ((0, ref_utils_1.isRef)(node.schema) ? ctx.resolve(node.schema).node : node.schema);
|
|
13
|
+
if (schema &&
|
|
14
|
+
shouldReportMissingStyleAndExplode(node, schema, options)) {
|
|
16
15
|
ctx.report({
|
|
17
16
|
message: `Parameter \`${node.name}\` should have \`style\` and \`explode \` fields`,
|
|
18
17
|
location: ctx.location,
|
package/lib/types/arazzo.js
CHANGED
|
@@ -87,7 +87,7 @@ const ReusableObject = {
|
|
|
87
87
|
};
|
|
88
88
|
const Parameter = {
|
|
89
89
|
properties: {
|
|
90
|
-
in: { type: 'string', enum: ['header', 'query', 'path', 'cookie'
|
|
90
|
+
in: { type: 'string', enum: ['header', 'query', 'path', 'cookie'] },
|
|
91
91
|
name: { type: 'string' },
|
|
92
92
|
value: {}, // any
|
|
93
93
|
},
|
package/lib/types/oas3_1.js
CHANGED
|
@@ -1015,7 +1015,7 @@ const ConfigReferenceDocs = {
|
|
|
1015
1015
|
showObjectSchemaExamples: { type: 'boolean' },
|
|
1016
1016
|
disableTryItRequestUrlEncoding: { type: 'boolean' },
|
|
1017
1017
|
sidebarLinks: 'ConfigSidebarLinks',
|
|
1018
|
-
sideNavStyle: { enum: ['summary-only', 'path-first', 'id-only'] },
|
|
1018
|
+
sideNavStyle: { enum: ['summary-only', 'path-first', 'id-only', 'path-only'] },
|
|
1019
1019
|
simpleOneOfTypeLabel: { type: 'boolean' },
|
|
1020
1020
|
sortEnumValuesAlphabetically: { type: 'boolean' },
|
|
1021
1021
|
sortOperationsAlphabetically: { type: 'boolean' },
|
package/lib/typings/arazzo.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface ArazzoSourceDescription {
|
|
|
17
17
|
}
|
|
18
18
|
export type SourceDescription = OpenAPISourceDescription | ArazzoSourceDescription;
|
|
19
19
|
export interface Parameter {
|
|
20
|
-
in?: 'header' | 'query' | 'path' | 'cookie'
|
|
20
|
+
in?: 'header' | 'query' | 'path' | 'cookie';
|
|
21
21
|
name: string;
|
|
22
22
|
value: string | number | boolean;
|
|
23
23
|
reference?: string;
|
package/lib/typings/openapi.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
interface Oas3DefinitionBase<T extends Oas3Schema | Oas3_1Schema> {
|
|
2
2
|
openapi: string;
|
|
3
3
|
info?: Oas3Info;
|
|
4
4
|
servers?: Oas3Server[];
|
|
5
|
-
paths?: Oas3Paths
|
|
6
|
-
components?: Oas3Components;
|
|
5
|
+
paths?: Oas3Paths<T>;
|
|
6
|
+
components?: T extends Oas3_1Schema ? Oas3_1Components : Oas3Components;
|
|
7
7
|
security?: Oas3SecurityRequirement[];
|
|
8
8
|
tags?: Oas3Tag[];
|
|
9
9
|
externalDocs?: Oas3ExternalDocs;
|
|
10
|
-
|
|
10
|
+
}
|
|
11
|
+
export interface Oas3Definition extends Oas3DefinitionBase<Oas3Schema> {
|
|
12
|
+
'x-webhooks'?: Oas3Webhooks<Oas3Schema>;
|
|
13
|
+
}
|
|
14
|
+
export interface Oas3_1Definition extends Oas3DefinitionBase<Oas3_1Schema> {
|
|
15
|
+
webhooks?: Oas3Webhooks<Oas3_1Schema>;
|
|
11
16
|
}
|
|
12
17
|
export interface Oas3Info {
|
|
13
18
|
title: string;
|
|
@@ -29,43 +34,43 @@ export interface Oas3ServerVariable {
|
|
|
29
34
|
default: string;
|
|
30
35
|
description?: string;
|
|
31
36
|
}
|
|
32
|
-
export interface Oas3Paths {
|
|
33
|
-
[path: string]: Referenced<Oas3PathItem
|
|
37
|
+
export interface Oas3Paths<T extends Oas3Schema | Oas3_1Schema = Oas3Schema | Oas3_1Schema> {
|
|
38
|
+
[path: string]: Referenced<Oas3PathItem<T>>;
|
|
34
39
|
}
|
|
35
40
|
export interface OasRef {
|
|
36
41
|
$ref: string;
|
|
37
42
|
}
|
|
38
43
|
export type Referenced<T> = OasRef | T;
|
|
39
|
-
export interface Oas3PathItem {
|
|
44
|
+
export interface Oas3PathItem<T extends Oas3Schema | Oas3_1Schema = Oas3Schema | Oas3_1Schema> {
|
|
40
45
|
summary?: string;
|
|
41
46
|
description?: string;
|
|
42
|
-
get?: Oas3Operation
|
|
43
|
-
put?: Oas3Operation
|
|
44
|
-
post?: Oas3Operation
|
|
45
|
-
delete?: Oas3Operation
|
|
46
|
-
options?: Oas3Operation
|
|
47
|
-
head?: Oas3Operation
|
|
48
|
-
patch?: Oas3Operation
|
|
49
|
-
trace?: Oas3Operation
|
|
47
|
+
get?: Oas3Operation<T>;
|
|
48
|
+
put?: Oas3Operation<T>;
|
|
49
|
+
post?: Oas3Operation<T>;
|
|
50
|
+
delete?: Oas3Operation<T>;
|
|
51
|
+
options?: Oas3Operation<T>;
|
|
52
|
+
head?: Oas3Operation<T>;
|
|
53
|
+
patch?: Oas3Operation<T>;
|
|
54
|
+
trace?: Oas3Operation<T>;
|
|
50
55
|
servers?: Oas3Server[];
|
|
51
|
-
parameters?: Array<Referenced<Oas3Parameter
|
|
56
|
+
parameters?: Array<Referenced<Oas3Parameter<T>>>;
|
|
52
57
|
}
|
|
53
58
|
export interface Oas3XCodeSample {
|
|
54
59
|
lang: string;
|
|
55
60
|
label?: string;
|
|
56
61
|
source: string;
|
|
57
62
|
}
|
|
58
|
-
export interface Oas3Operation {
|
|
63
|
+
export interface Oas3Operation<T extends Oas3Schema | Oas3_1Schema = Oas3Schema | Oas3_1Schema> {
|
|
59
64
|
tags?: string[];
|
|
60
65
|
summary?: string;
|
|
61
66
|
description?: string;
|
|
62
67
|
externalDocs?: Oas3ExternalDocs;
|
|
63
68
|
operationId?: string;
|
|
64
|
-
parameters?: Array<Referenced<Oas3Parameter
|
|
65
|
-
requestBody?: Referenced<Oas3RequestBody
|
|
66
|
-
responses: Oas3Responses
|
|
69
|
+
parameters?: Array<Referenced<Oas3Parameter<T>>>;
|
|
70
|
+
requestBody?: Referenced<Oas3RequestBody<T>>;
|
|
71
|
+
responses: Oas3Responses<T>;
|
|
67
72
|
callbacks?: {
|
|
68
|
-
[name: string]: Referenced<Oas3Callback
|
|
73
|
+
[name: string]: Referenced<Oas3Callback<T>>;
|
|
69
74
|
};
|
|
70
75
|
deprecated?: boolean;
|
|
71
76
|
security?: Oas3SecurityRequirement[];
|
|
@@ -74,7 +79,7 @@ export interface Oas3Operation {
|
|
|
74
79
|
'x-code-samples'?: Oas3XCodeSample[];
|
|
75
80
|
'x-hideTryItPanel'?: boolean;
|
|
76
81
|
}
|
|
77
|
-
export interface Oas3Parameter {
|
|
82
|
+
export interface Oas3Parameter<T extends Oas3Schema | Oas3_1Schema = Oas3Schema | Oas3_1Schema> {
|
|
78
83
|
name: string;
|
|
79
84
|
in?: Oas3ParameterLocation;
|
|
80
85
|
description?: string;
|
|
@@ -84,17 +89,17 @@ export interface Oas3Parameter {
|
|
|
84
89
|
style?: Oas3ParameterStyle;
|
|
85
90
|
explode?: boolean;
|
|
86
91
|
allowReserved?: boolean;
|
|
87
|
-
schema?: Referenced<
|
|
88
|
-
example?:
|
|
92
|
+
schema?: Referenced<T>;
|
|
93
|
+
example?: unknown;
|
|
89
94
|
examples?: {
|
|
90
95
|
[media: string]: Referenced<Oas3Example>;
|
|
91
96
|
};
|
|
92
97
|
content?: {
|
|
93
|
-
[media: string]: Oas3MediaType
|
|
98
|
+
[media: string]: Oas3MediaType<T>;
|
|
94
99
|
};
|
|
95
100
|
}
|
|
96
101
|
export interface Oas3Example {
|
|
97
|
-
value:
|
|
102
|
+
value: unknown;
|
|
98
103
|
summary?: string;
|
|
99
104
|
description?: string;
|
|
100
105
|
externalValue?: string;
|
|
@@ -106,15 +111,14 @@ export interface Oas3Xml {
|
|
|
106
111
|
attribute?: string;
|
|
107
112
|
wrapped?: string;
|
|
108
113
|
}
|
|
109
|
-
interface Oas3XSchemaBase<T> {
|
|
114
|
+
interface Oas3XSchemaBase<T extends Oas3Schema | Oas3_1Schema> {
|
|
110
115
|
$ref?: string;
|
|
111
116
|
properties?: {
|
|
112
|
-
[name: string]: T
|
|
117
|
+
[name: string]: Referenced<T>;
|
|
113
118
|
};
|
|
114
119
|
additionalProperties?: boolean | T;
|
|
115
120
|
description?: string;
|
|
116
|
-
default?:
|
|
117
|
-
items?: T;
|
|
121
|
+
default?: unknown;
|
|
118
122
|
required?: string[];
|
|
119
123
|
readOnly?: boolean;
|
|
120
124
|
writeOnly?: boolean;
|
|
@@ -122,7 +126,6 @@ interface Oas3XSchemaBase<T> {
|
|
|
122
126
|
format?: string;
|
|
123
127
|
externalDocs?: Oas3ExternalDocs;
|
|
124
128
|
discriminator?: Oas3Discriminator;
|
|
125
|
-
nullable?: boolean;
|
|
126
129
|
oneOf?: T[];
|
|
127
130
|
anyOf?: T[];
|
|
128
131
|
allOf?: T[];
|
|
@@ -130,35 +133,70 @@ interface Oas3XSchemaBase<T> {
|
|
|
130
133
|
title?: string;
|
|
131
134
|
multipleOf?: number;
|
|
132
135
|
maximum?: number;
|
|
133
|
-
exclusiveMaximum?: boolean;
|
|
134
136
|
minimum?: number;
|
|
135
|
-
exclusiveMinimum?: boolean;
|
|
136
137
|
maxLength?: number;
|
|
137
138
|
minLength?: number;
|
|
138
139
|
pattern?: string;
|
|
140
|
+
items?: boolean | T;
|
|
139
141
|
maxItems?: number;
|
|
140
142
|
minItems?: number;
|
|
141
143
|
uniqueItems?: boolean;
|
|
142
144
|
maxProperties?: number;
|
|
143
145
|
minProperties?: number;
|
|
144
|
-
enum?:
|
|
145
|
-
example?:
|
|
146
|
+
enum?: unknown[];
|
|
147
|
+
example?: unknown;
|
|
146
148
|
xml?: Oas3Xml;
|
|
147
149
|
'x-tags'?: string[];
|
|
148
150
|
}
|
|
149
151
|
export interface Oas3Schema extends Oas3XSchemaBase<Oas3Schema> {
|
|
150
152
|
type?: string;
|
|
153
|
+
exclusiveMaximum?: boolean;
|
|
154
|
+
exclusiveMinimum?: boolean;
|
|
155
|
+
nullable?: boolean;
|
|
151
156
|
}
|
|
152
157
|
export interface Oas3_1Schema extends Oas3XSchemaBase<Oas3_1Schema> {
|
|
158
|
+
$id?: string;
|
|
159
|
+
$schema?: string;
|
|
160
|
+
$anchor?: string;
|
|
161
|
+
$dynamicAnchor?: string;
|
|
162
|
+
$dynamicRef?: string;
|
|
163
|
+
$defs?: {
|
|
164
|
+
[name: string]: Referenced<Oas3_1Schema>;
|
|
165
|
+
};
|
|
166
|
+
$vocabulary?: {
|
|
167
|
+
[uri: string]: boolean;
|
|
168
|
+
};
|
|
169
|
+
$comment?: string;
|
|
153
170
|
type?: string | string[];
|
|
154
|
-
examples?:
|
|
171
|
+
examples?: unknown[];
|
|
155
172
|
prefixItems?: Oas3_1Schema[];
|
|
173
|
+
exclusiveMaximum?: number;
|
|
174
|
+
exclusiveMinimum?: number;
|
|
175
|
+
const?: unknown;
|
|
176
|
+
contains?: Oas3_1Schema;
|
|
177
|
+
minContains?: number;
|
|
178
|
+
maxContains?: number;
|
|
179
|
+
propertyNames?: Oas3_1Schema;
|
|
180
|
+
if?: Oas3_1Schema;
|
|
181
|
+
then?: Oas3_1Schema;
|
|
182
|
+
else?: Oas3_1Schema;
|
|
183
|
+
dependentRequired?: {
|
|
184
|
+
[name: string]: string[];
|
|
185
|
+
};
|
|
186
|
+
dependentSchemas?: {
|
|
187
|
+
[name: string]: Referenced<Oas3_1Schema>;
|
|
188
|
+
};
|
|
189
|
+
patternProperties?: {
|
|
190
|
+
[name: string]: Referenced<Oas3_1Schema>;
|
|
191
|
+
};
|
|
192
|
+
unevaluatedItems?: boolean | Oas3_1Schema;
|
|
193
|
+
unevaluatedProperties?: boolean | Oas3_1Schema;
|
|
194
|
+
contentSchema?: Oas3_1Schema;
|
|
195
|
+
contentMediaType?: string;
|
|
196
|
+
contentEncoding?: string;
|
|
156
197
|
}
|
|
157
|
-
export interface
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
export interface Oas3_1Webhooks {
|
|
161
|
-
[webhook: string]: Referenced<Oas3PathItem>;
|
|
198
|
+
export interface Oas3Webhooks<T extends Oas3Schema | Oas3_1Schema> {
|
|
199
|
+
[webhook: string]: Referenced<Oas3PathItem<T>>;
|
|
162
200
|
}
|
|
163
201
|
export interface Oas3Discriminator {
|
|
164
202
|
propertyName: string;
|
|
@@ -167,20 +205,20 @@ export interface Oas3Discriminator {
|
|
|
167
205
|
};
|
|
168
206
|
'x-explicitMappingOnly'?: boolean;
|
|
169
207
|
}
|
|
170
|
-
export interface Oas3MediaType {
|
|
171
|
-
schema?: Referenced<
|
|
172
|
-
example?:
|
|
208
|
+
export interface Oas3MediaType<T extends Oas3Schema | Oas3_1Schema = Oas3Schema | Oas3_1Schema> {
|
|
209
|
+
schema?: Referenced<T>;
|
|
210
|
+
example?: unknown;
|
|
173
211
|
examples?: {
|
|
174
212
|
[name: string]: Referenced<Oas3Example>;
|
|
175
213
|
};
|
|
176
214
|
encoding?: {
|
|
177
|
-
[field: string]: Oas3Encoding
|
|
215
|
+
[field: string]: Oas3Encoding<T>;
|
|
178
216
|
};
|
|
179
217
|
}
|
|
180
|
-
export interface Oas3Encoding {
|
|
218
|
+
export interface Oas3Encoding<T extends Oas3Schema | Oas3_1Schema = Oas3Schema | Oas3_1Schema> {
|
|
181
219
|
contentType: string;
|
|
182
220
|
headers?: {
|
|
183
|
-
[name: string]: Referenced<Oas3Header
|
|
221
|
+
[name: string]: Referenced<Oas3Header<T>>;
|
|
184
222
|
};
|
|
185
223
|
style: Oas3ParameterStyle;
|
|
186
224
|
explode: boolean;
|
|
@@ -188,53 +226,60 @@ export interface Oas3Encoding {
|
|
|
188
226
|
}
|
|
189
227
|
export type Oas3ParameterLocation = 'query' | 'header' | 'path' | 'cookie';
|
|
190
228
|
export type Oas3ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
|
|
191
|
-
export interface Oas3RequestBody {
|
|
229
|
+
export interface Oas3RequestBody<T extends Oas3Schema | Oas3_1Schema = Oas3Schema | Oas3_1Schema> {
|
|
192
230
|
description?: string;
|
|
193
231
|
required?: boolean;
|
|
194
232
|
content: {
|
|
195
|
-
[mime: string]: Oas3MediaType
|
|
233
|
+
[mime: string]: Oas3MediaType<T>;
|
|
196
234
|
};
|
|
197
235
|
}
|
|
198
|
-
export interface Oas3Responses {
|
|
199
|
-
[code: string]: Oas3Response
|
|
236
|
+
export interface Oas3Responses<T extends Oas3Schema | Oas3_1Schema = Oas3Schema | Oas3_1Schema> {
|
|
237
|
+
[code: string]: Oas3Response<T>;
|
|
200
238
|
}
|
|
201
|
-
export interface Oas3Response {
|
|
239
|
+
export interface Oas3Response<T extends Oas3Schema | Oas3_1Schema = Oas3Schema | Oas3_1Schema> {
|
|
202
240
|
description?: string;
|
|
203
241
|
headers?: {
|
|
204
|
-
[name: string]: Referenced<Oas3Header
|
|
242
|
+
[name: string]: Referenced<Oas3Header<T>>;
|
|
205
243
|
};
|
|
206
244
|
content?: {
|
|
207
|
-
[mime: string]: Oas3MediaType
|
|
245
|
+
[mime: string]: Oas3MediaType<T>;
|
|
208
246
|
};
|
|
209
247
|
links?: {
|
|
210
248
|
[name: string]: Referenced<Oas3Link>;
|
|
211
249
|
};
|
|
212
250
|
}
|
|
213
251
|
export interface Oas3Link {
|
|
214
|
-
|
|
252
|
+
operationRef?: string;
|
|
253
|
+
operationId?: string;
|
|
254
|
+
parameters?: {
|
|
255
|
+
[name: string]: unknown;
|
|
256
|
+
};
|
|
257
|
+
requestBody?: unknown;
|
|
258
|
+
description?: string;
|
|
259
|
+
server?: Oas3Server;
|
|
215
260
|
}
|
|
216
|
-
export type Oas3Header = Omit<Oas3Parameter
|
|
217
|
-
export interface Oas3Callback {
|
|
218
|
-
[name: string]: Oas3PathItem
|
|
261
|
+
export type Oas3Header<T extends Oas3Schema | Oas3_1Schema = Oas3Schema | Oas3_1Schema> = Omit<Oas3Parameter<T>, 'in' | 'name'>;
|
|
262
|
+
export interface Oas3Callback<T extends Oas3Schema | Oas3_1Schema = Oas3Schema | Oas3_1Schema> {
|
|
263
|
+
[name: string]: Oas3PathItem<T>;
|
|
219
264
|
}
|
|
220
|
-
export interface
|
|
265
|
+
export interface Oas3ComponentsBase<T extends Oas3Schema | Oas3_1Schema> {
|
|
221
266
|
schemas?: {
|
|
222
|
-
[name: string]: Referenced<
|
|
267
|
+
[name: string]: Referenced<T>;
|
|
223
268
|
};
|
|
224
269
|
responses?: {
|
|
225
|
-
[name: string]: Referenced<Oas3Response
|
|
270
|
+
[name: string]: Referenced<Oas3Response<T>>;
|
|
226
271
|
};
|
|
227
272
|
parameters?: {
|
|
228
|
-
[name: string]: Referenced<Oas3Parameter
|
|
273
|
+
[name: string]: Referenced<Oas3Parameter<T>>;
|
|
229
274
|
};
|
|
230
275
|
examples?: {
|
|
231
276
|
[name: string]: Referenced<Oas3Example>;
|
|
232
277
|
};
|
|
233
278
|
requestBodies?: {
|
|
234
|
-
[name: string]: Referenced<Oas3RequestBody
|
|
279
|
+
[name: string]: Referenced<Oas3RequestBody<T>>;
|
|
235
280
|
};
|
|
236
281
|
headers?: {
|
|
237
|
-
[name: string]: Referenced<Oas3Header
|
|
282
|
+
[name: string]: Referenced<Oas3Header<T>>;
|
|
238
283
|
};
|
|
239
284
|
securitySchemes?: {
|
|
240
285
|
[name: string]: Referenced<Oas3SecurityScheme>;
|
|
@@ -243,10 +288,17 @@ export interface Oas3Components {
|
|
|
243
288
|
[name: string]: Referenced<Oas3Link>;
|
|
244
289
|
};
|
|
245
290
|
callbacks?: {
|
|
246
|
-
[name: string]: Referenced<Oas3Callback
|
|
291
|
+
[name: string]: Referenced<Oas3Callback<T>>;
|
|
247
292
|
};
|
|
248
293
|
}
|
|
249
|
-
export
|
|
294
|
+
export interface Oas3_1Components extends Oas3ComponentsBase<Oas3_1Schema> {
|
|
295
|
+
pathItems?: {
|
|
296
|
+
[name: string]: Referenced<Oas3PathItem<Oas3_1Schema>>;
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
export interface Oas3Components extends Oas3ComponentsBase<Oas3Schema> {
|
|
300
|
+
}
|
|
301
|
+
export type Oas3ComponentName<T extends Oas3Schema | Oas3_1Schema = Oas3Schema | Oas3_1Schema> = keyof Oas3ComponentsBase<T>;
|
|
250
302
|
export interface Oas3SecurityRequirement {
|
|
251
303
|
[name: string]: string[];
|
|
252
304
|
}
|
package/lib/utils.d.ts
CHANGED
|
@@ -65,3 +65,6 @@ export declare function getProxyAgent(): HttpsProxyAgent<string> | undefined;
|
|
|
65
65
|
*/
|
|
66
66
|
export declare function dequal(foo: any, bar: any): boolean;
|
|
67
67
|
export type CollectFn = (value: unknown) => void;
|
|
68
|
+
export type StrictObject<T extends object> = T & {
|
|
69
|
+
[key: string]: undefined;
|
|
70
|
+
};
|
package/lib/utils.js
CHANGED
|
@@ -40,7 +40,6 @@ exports.dequal = dequal;
|
|
|
40
40
|
const fs = require("fs");
|
|
41
41
|
const path_1 = require("path");
|
|
42
42
|
const minimatch = require("minimatch");
|
|
43
|
-
const node_fetch_1 = require("node-fetch");
|
|
44
43
|
const js_yaml_1 = require("./js-yaml");
|
|
45
44
|
const env_1 = require("./env");
|
|
46
45
|
const logger_1 = require("./logger");
|
|
@@ -91,7 +90,7 @@ async function readFileFromUrl(url, config) {
|
|
|
91
90
|
header.envVariable !== undefined ? env_1.env[header.envVariable] || '' : header.value;
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
|
-
const req = await (config.customFetch ||
|
|
93
|
+
const req = await (config.customFetch || fetch)(url, {
|
|
95
94
|
headers: headers,
|
|
96
95
|
});
|
|
97
96
|
if (!req.ok) {
|
package/lib/visitors.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { NormalizedNodeType } from './types';
|
|
|
2
2
|
import type { Stack } from './utils';
|
|
3
3
|
import type { UserContext, ResolveResult, ProblemSeverity } from './walk';
|
|
4
4
|
import type { Location } from './ref-utils';
|
|
5
|
-
import type { Oas3Definition, Oas3ExternalDocs, Oas3Info, Oas3Contact, Oas3Components, Oas3License, Oas3Schema, Oas3Header, Oas3Parameter, Oas3Operation, Oas3PathItem, Oas3ServerVariable, Oas3Server, Oas3MediaType, Oas3Response, Oas3Example, Oas3RequestBody, Oas3Tag, OasRef, Oas3SecurityScheme, Oas3SecurityRequirement, Oas3Encoding, Oas3Link, Oas3Xml, Oas3Discriminator, Oas3Callback } from './typings/openapi';
|
|
5
|
+
import type { Oas3Definition, Oas3_1Definition, Oas3ExternalDocs, Oas3Info, Oas3Contact, Oas3Components, Oas3_1Components, Oas3License, Oas3Schema, Oas3_1Schema, Oas3Header, Oas3Parameter, Oas3Operation, Oas3PathItem, Oas3ServerVariable, Oas3Server, Oas3MediaType, Oas3Response, Oas3Example, Oas3RequestBody, Oas3Tag, OasRef, Oas3SecurityScheme, Oas3SecurityRequirement, Oas3Encoding, Oas3Link, Oas3Xml, Oas3Discriminator, Oas3Callback } from './typings/openapi';
|
|
6
6
|
import type { Oas2Definition, Oas2Tag, Oas2ExternalDocs, Oas2SecurityRequirement, Oas2Info, Oas2Contact, Oas2License, Oas2PathItem, Oas2Operation, Oas2Header, Oas2Response, Oas2Schema, Oas2Xml, Oas2Parameter, Oas2SecurityScheme } from './typings/swagger';
|
|
7
7
|
import type { Async2Definition } from './typings/asyncapi';
|
|
8
8
|
import type { Async3Definition } from './typings/asyncapi3';
|
|
@@ -67,7 +67,7 @@ export type BaseVisitor = {
|
|
|
67
67
|
} | VisitRefFunction;
|
|
68
68
|
};
|
|
69
69
|
type Oas3FlatVisitor = {
|
|
70
|
-
Root?: VisitFunctionOrObject<Oas3Definition>;
|
|
70
|
+
Root?: VisitFunctionOrObject<Oas3Definition | Oas3_1Definition>;
|
|
71
71
|
Tag?: VisitFunctionOrObject<Oas3Tag>;
|
|
72
72
|
ExternalDocs?: VisitFunctionOrObject<Oas3ExternalDocs>;
|
|
73
73
|
Server?: VisitFunctionOrObject<Oas3Server>;
|
|
@@ -76,36 +76,36 @@ type Oas3FlatVisitor = {
|
|
|
76
76
|
Info?: VisitFunctionOrObject<Oas3Info>;
|
|
77
77
|
Contact?: VisitFunctionOrObject<Oas3Contact>;
|
|
78
78
|
License?: VisitFunctionOrObject<Oas3License>;
|
|
79
|
-
Paths?: VisitFunctionOrObject<Record<string, Oas3PathItem
|
|
80
|
-
PathItem?: VisitFunctionOrObject<Oas3PathItem
|
|
81
|
-
Callback?: VisitFunctionOrObject<Oas3Callback
|
|
82
|
-
CallbacksMap?: VisitFunctionOrObject<Record<string, Oas3Callback
|
|
83
|
-
Parameter?: VisitFunctionOrObject<Oas3Parameter
|
|
84
|
-
Operation?: VisitFunctionOrObject<Oas3Operation
|
|
85
|
-
RequestBody?: VisitFunctionOrObject<Oas3RequestBody
|
|
86
|
-
MediaTypesMap?: VisitFunctionOrObject<Record<string, Oas3MediaType
|
|
87
|
-
MediaType?: VisitFunctionOrObject<Oas3MediaType
|
|
79
|
+
Paths?: VisitFunctionOrObject<Record<string, Oas3PathItem<Oas3Schema | Oas3_1Schema>>>;
|
|
80
|
+
PathItem?: VisitFunctionOrObject<Oas3PathItem<Oas3Schema | Oas3_1Schema>>;
|
|
81
|
+
Callback?: VisitFunctionOrObject<Oas3Callback<Oas3Schema | Oas3_1Schema>>;
|
|
82
|
+
CallbacksMap?: VisitFunctionOrObject<Record<string, Oas3Callback<Oas3Schema | Oas3_1Schema>>>;
|
|
83
|
+
Parameter?: VisitFunctionOrObject<Oas3Parameter<Oas3Schema | Oas3_1Schema>>;
|
|
84
|
+
Operation?: VisitFunctionOrObject<Oas3Operation<Oas3Schema | Oas3_1Schema>>;
|
|
85
|
+
RequestBody?: VisitFunctionOrObject<Oas3RequestBody<Oas3Schema | Oas3_1Schema>>;
|
|
86
|
+
MediaTypesMap?: VisitFunctionOrObject<Record<string, Oas3MediaType<Oas3Schema | Oas3_1Schema>>>;
|
|
87
|
+
MediaType?: VisitFunctionOrObject<Oas3MediaType<Oas3Schema | Oas3_1Schema>>;
|
|
88
88
|
Example?: VisitFunctionOrObject<Oas3Example>;
|
|
89
|
-
Encoding?: VisitFunctionOrObject<Oas3Encoding
|
|
90
|
-
Header?: VisitFunctionOrObject<Oas3Header
|
|
91
|
-
Responses?: VisitFunctionOrObject<Record<string, Oas3Response
|
|
92
|
-
Response?: VisitFunctionOrObject<Oas3Response
|
|
89
|
+
Encoding?: VisitFunctionOrObject<Oas3Encoding<Oas3Schema | Oas3_1Schema>>;
|
|
90
|
+
Header?: VisitFunctionOrObject<Oas3Header<Oas3Schema | Oas3_1Schema>>;
|
|
91
|
+
Responses?: VisitFunctionOrObject<Record<string, Oas3Response<Oas3Schema | Oas3_1Schema>>>;
|
|
92
|
+
Response?: VisitFunctionOrObject<Oas3Response<Oas3Schema | Oas3_1Schema>>;
|
|
93
93
|
Link?: VisitFunctionOrObject<Oas3Link>;
|
|
94
|
-
Schema?: VisitFunctionOrObject<Oas3Schema>;
|
|
94
|
+
Schema?: VisitFunctionOrObject<Oas3Schema | Oas3_1Schema>;
|
|
95
95
|
Xml?: VisitFunctionOrObject<Oas3Xml>;
|
|
96
96
|
SchemaProperties?: VisitFunctionOrObject<Record<string, Oas3Schema>>;
|
|
97
97
|
DiscriminatorMapping?: VisitFunctionOrObject<Record<string, string>>;
|
|
98
98
|
Discriminator?: VisitFunctionOrObject<Oas3Discriminator>;
|
|
99
|
-
Components?: VisitFunctionOrObject<Oas3Components>;
|
|
99
|
+
Components?: VisitFunctionOrObject<Oas3Components | Oas3_1Components>;
|
|
100
100
|
NamedSchemas?: VisitFunctionOrObject<Record<string, Oas3Schema>>;
|
|
101
|
-
NamedResponses?: VisitFunctionOrObject<Record<string, Oas3Response
|
|
102
|
-
NamedParameters?: VisitFunctionOrObject<Record<string, Oas3Parameter
|
|
101
|
+
NamedResponses?: VisitFunctionOrObject<Record<string, Oas3Response<Oas3Schema | Oas3_1Schema>>>;
|
|
102
|
+
NamedParameters?: VisitFunctionOrObject<Record<string, Oas3Parameter<Oas3Schema | Oas3_1Schema>>>;
|
|
103
103
|
NamedExamples?: VisitFunctionOrObject<Record<string, Oas3Example>>;
|
|
104
|
-
NamedRequestBodies?: VisitFunctionOrObject<Record<string, Oas3RequestBody
|
|
105
|
-
NamedHeaders?: VisitFunctionOrObject<Record<string, Oas3Header
|
|
104
|
+
NamedRequestBodies?: VisitFunctionOrObject<Record<string, Oas3RequestBody<Oas3Schema | Oas3_1Schema>>>;
|
|
105
|
+
NamedHeaders?: VisitFunctionOrObject<Record<string, Oas3Header<Oas3Schema | Oas3_1Schema>>>;
|
|
106
106
|
NamedSecuritySchemes?: VisitFunctionOrObject<Record<string, Oas3SecurityScheme>>;
|
|
107
107
|
NamedLinks?: VisitFunctionOrObject<Record<string, Oas3Link>>;
|
|
108
|
-
NamedCallbacks?: VisitFunctionOrObject<Record<string, Oas3Callback
|
|
108
|
+
NamedCallbacks?: VisitFunctionOrObject<Record<string, Oas3Callback<Oas3Schema | Oas3_1Schema>>>;
|
|
109
109
|
ImplicitFlow?: VisitFunctionOrObject<Oas3SecurityScheme['flows']['implicit']>;
|
|
110
110
|
PasswordFlow?: VisitFunctionOrObject<Oas3SecurityScheme['flows']['password']>;
|
|
111
111
|
ClientCredentials?: VisitFunctionOrObject<Oas3SecurityScheme['flows']['clientCredentials']>;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"engines": {
|
|
7
|
-
"node": ">=
|
|
8
|
-
"npm": ">=
|
|
7
|
+
"node": ">=18.17.0",
|
|
8
|
+
"npm": ">=10.8.2"
|
|
9
9
|
},
|
|
10
10
|
"engineStrict": true,
|
|
11
11
|
"license": "MIT",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"fs": false,
|
|
18
18
|
"path": "path-browserify",
|
|
19
19
|
"os": false,
|
|
20
|
-
"node-fetch": false,
|
|
21
20
|
"colorette": false,
|
|
22
21
|
"https-proxy-agent": false
|
|
23
22
|
},
|
|
@@ -36,13 +35,12 @@
|
|
|
36
35
|
],
|
|
37
36
|
"dependencies": {
|
|
38
37
|
"@redocly/ajv": "^8.11.2",
|
|
39
|
-
"@redocly/config": "^0.
|
|
38
|
+
"@redocly/config": "^0.20.1",
|
|
40
39
|
"colorette": "^1.2.0",
|
|
41
|
-
"https-proxy-agent": "^7.0.
|
|
40
|
+
"https-proxy-agent": "^7.0.5",
|
|
42
41
|
"js-levenshtein": "^1.1.6",
|
|
43
42
|
"js-yaml": "^4.1.0",
|
|
44
43
|
"minimatch": "^5.0.1",
|
|
45
|
-
"node-fetch": "^2.6.1",
|
|
46
44
|
"pluralize": "^8.0.0",
|
|
47
45
|
"yaml-ast-parser": "0.0.43"
|
|
48
46
|
},
|
|
@@ -50,8 +48,6 @@
|
|
|
50
48
|
"@types/js-levenshtein": "^1.1.0",
|
|
51
49
|
"@types/js-yaml": "^4.0.3",
|
|
52
50
|
"@types/minimatch": "^3.0.5",
|
|
53
|
-
"@types/node": "^20.11.5",
|
|
54
|
-
"@types/node-fetch": "^2.5.7",
|
|
55
51
|
"@types/pluralize": "^0.0.29",
|
|
56
52
|
"json-schema-to-ts": "^3.1.0",
|
|
57
53
|
"typescript": "5.5.3"
|