@redocly/openapi-core 1.18.0 → 1.19.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 +20 -0
- package/lib/benchmark/benches/lint-with-many-rules.bench.js +2 -2
- package/lib/benchmark/benches/lint-with-nested-rule.bench.js +2 -2
- package/lib/benchmark/benches/lint-with-no-rules.bench.js +2 -2
- package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.js +2 -2
- package/lib/benchmark/benches/lint-with-top-level-rule.bench.js +2 -2
- package/lib/benchmark/benches/recommended-oas3.bench.js +2 -2
- package/lib/benchmark/benches/resolve-with-no-external.bench.js +2 -2
- package/lib/benchmark/utils.js +7 -4
- package/lib/bundle.d.ts +3 -3
- package/lib/bundle.js +128 -122
- package/lib/config/all.js +9 -0
- package/lib/config/builtIn.js +7 -1
- package/lib/config/config-resolvers.js +179 -138
- package/lib/config/config.d.ts +2 -2
- package/lib/config/config.js +53 -34
- package/lib/config/load.d.ts +1 -2
- package/lib/config/load.js +105 -117
- package/lib/config/minimal.js +9 -0
- package/lib/config/recommended-strict.js +9 -0
- package/lib/config/recommended.js +9 -0
- package/lib/config/rules.d.ts +3 -3
- package/lib/config/rules.js +1 -2
- package/lib/config/types.d.ts +9 -3
- package/lib/config/utils.js +70 -49
- package/lib/decorators/async3/index.d.ts +1 -0
- package/lib/decorators/async3/index.js +4 -0
- package/lib/decorators/common/filters/filter-helper.js +2 -3
- package/lib/decorators/common/filters/filter-in.js +1 -1
- package/lib/decorators/common/filters/filter-out.js +1 -1
- package/lib/decorators/common/info-override.js +1 -12
- package/lib/decorators/common/media-type-examples-override.js +8 -2
- package/lib/decorators/common/remove-x-internal.js +4 -5
- package/lib/decorators/oas2/remove-unused-components.js +1 -2
- package/lib/decorators/oas3/remove-unused-components.js +1 -2
- package/lib/env.d.ts +0 -1
- package/lib/env.js +1 -1
- package/lib/format/codeframes.js +10 -8
- package/lib/format/format.js +23 -15
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -4
- package/lib/js-yaml/index.js +1 -1
- package/lib/lint.d.ts +2 -0
- package/lib/lint.js +92 -99
- package/lib/oas-types.d.ts +9 -5
- package/lib/oas-types.js +22 -12
- package/lib/redocly/domains.js +6 -6
- package/lib/redocly/index.js +60 -73
- package/lib/redocly/registry-api.js +64 -82
- package/lib/ref-utils.js +13 -13
- package/lib/resolve.js +186 -205
- package/lib/rules/ajv.js +10 -8
- package/lib/rules/async3/channels-kebab-case.d.ts +2 -0
- package/lib/rules/async3/channels-kebab-case.js +19 -0
- package/lib/rules/async3/index.d.ts +3 -0
- package/lib/rules/async3/index.js +22 -0
- package/lib/rules/async3/no-channel-trailing-slash.d.ts +2 -0
- package/lib/rules/async3/no-channel-trailing-slash.js +16 -0
- package/lib/rules/common/assertions/asserts.js +5 -5
- package/lib/rules/common/assertions/index.d.ts +5 -4
- package/lib/rules/common/assertions/utils.js +43 -28
- package/lib/rules/common/no-invalid-parameter-examples.js +1 -2
- package/lib/rules/common/no-invalid-schema-examples.js +1 -2
- package/lib/rules/common/no-required-schema-properties-undefined.js +1 -2
- package/lib/rules/common/operation-tag-defined.js +1 -2
- package/lib/rules/common/path-http-verbs-order.js +1 -1
- package/lib/rules/common/path-segment-plural.js +2 -1
- package/lib/rules/common/required-string-property-missing-min-length.js +2 -2
- package/lib/rules/common/response-contains-header.js +2 -2
- package/lib/rules/common/security-defined.js +3 -7
- package/lib/rules/common/spec.d.ts +2 -2
- package/lib/rules/common/spec.js +6 -7
- package/lib/rules/no-unresolved-refs.js +3 -4
- package/lib/rules/oas2/response-contains-property.js +1 -2
- package/lib/rules/oas3/array-parameter-serialization.js +1 -2
- package/lib/rules/oas3/component-name-unique.js +2 -4
- package/lib/rules/oas3/no-invalid-media-type-examples.js +1 -2
- package/lib/rules/oas3/no-server-variables-empty-enum.js +1 -2
- package/lib/rules/oas3/no-undefined-server-variable.js +2 -3
- package/lib/rules/oas3/no-unused-components.js +1 -2
- package/lib/rules/oas3/response-contains-property.js +1 -2
- package/lib/rules/utils.js +14 -12
- package/lib/types/arazzo.d.ts +1299 -73
- package/lib/types/arazzo.js +41 -36
- package/lib/types/asyncapi2.d.ts +17 -0
- package/lib/types/{asyncapi.js → asyncapi2.js} +71 -93
- package/lib/types/asyncapi3.d.ts +2 -0
- package/lib/types/asyncapi3.js +347 -0
- package/lib/types/index.js +19 -10
- package/lib/types/json-schema-adapter.js +4 -18
- package/lib/types/oas2.js +6 -6
- package/lib/types/oas3.js +10 -10
- package/lib/types/oas3_1.js +15 -9
- package/lib/types/redocly-yaml.d.ts +3 -1
- package/lib/types/redocly-yaml.js +131 -35
- package/lib/typings/arazzo.d.ts +28 -1
- package/lib/typings/asyncapi3.d.ts +53 -0
- package/lib/typings/asyncapi3.js +2 -0
- package/lib/utils.d.ts +12 -7
- package/lib/utils.js +91 -77
- package/lib/visitors.d.ts +11 -0
- package/lib/visitors.js +21 -8
- package/lib/walk.js +30 -23
- package/package.json +3 -3
- package/src/__tests__/bundle.test.ts +142 -0
- package/src/__tests__/lint.test.ts +0 -50
- package/src/bundle.ts +19 -6
- package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +22 -0
- package/src/config/__tests__/__snapshots__/config.test.ts.snap +24 -0
- package/src/config/__tests__/config.test.ts +11 -0
- package/src/config/all.ts +9 -0
- package/src/config/builtIn.ts +6 -0
- package/src/config/config-resolvers.ts +15 -2
- package/src/config/config.ts +24 -5
- package/src/config/load.ts +1 -2
- package/src/config/minimal.ts +9 -0
- package/src/config/recommended-strict.ts +9 -0
- package/src/config/recommended.ts +9 -0
- package/src/config/rules.ts +12 -4
- package/src/config/types.ts +15 -2
- package/src/config/utils.ts +15 -0
- package/src/decorators/async3/index.ts +1 -0
- package/src/decorators/common/remove-x-internal.ts +2 -2
- package/src/index.ts +2 -1
- package/src/lint.ts +26 -3
- package/src/oas-types.ts +31 -13
- package/src/rules/arazzo/index.ts +1 -1
- package/src/rules/async2/index.ts +5 -5
- package/src/rules/async3/__tests__/channels-kebab-case.test.ts +141 -0
- package/src/rules/async3/__tests__/no-channel-trailing-slash.test.ts +96 -0
- package/src/rules/async3/channels-kebab-case.ts +19 -0
- package/src/rules/async3/index.ts +23 -0
- package/src/rules/async3/no-channel-trailing-slash.ts +16 -0
- package/src/rules/common/__tests__/spec.test.ts +47 -0
- package/src/rules/common/assertions/index.ts +13 -4
- package/src/rules/common/no-invalid-schema-examples.ts +3 -2
- package/src/rules/common/path-segment-plural.ts +3 -2
- package/src/rules/common/spec.ts +2 -2
- package/src/rules/oas2/index.ts +4 -4
- package/src/rules/oas3/index.ts +39 -37
- package/src/types/arazzo.ts +28 -23
- package/src/types/{asyncapi.ts → asyncapi2.ts} +58 -76
- package/src/types/asyncapi3.ts +381 -0
- package/src/types/oas3_1.ts +3 -2
- package/src/types/redocly-yaml.ts +14 -0
- package/src/typings/arazzo.ts +41 -1
- package/src/typings/asyncapi3.ts +61 -0
- package/src/utils.ts +46 -11
- package/src/visitors.ts +18 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/types/asyncapi.d.ts +0 -2
package/lib/types/arazzo.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArazzoTypes = exports.arazzoSchema = exports.ARAZZO_ROOT_TYPE = void 0;
|
|
3
|
+
exports.ArazzoTypes = exports.arazzoSchema = exports.workflow = exports.step = exports.inherit = exports.criteriaObject = exports.requestBody = exports.replacement = exports.infoObject = exports.parameter = exports.sourceDescriptionSchema = exports.expectSchema = exports.operationMethod = exports.ARAZZO_ROOT_TYPE = void 0;
|
|
4
4
|
const json_schema_adapter_1 = require("./json-schema-adapter");
|
|
5
5
|
exports.ARAZZO_ROOT_TYPE = 'Root';
|
|
6
|
-
|
|
6
|
+
exports.operationMethod = {
|
|
7
7
|
type: 'string',
|
|
8
8
|
enum: ['get', 'post', 'put', 'delete', 'patch'],
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
exports.expectSchema = {
|
|
11
11
|
type: 'object',
|
|
12
12
|
properties: {
|
|
13
13
|
statusCode: { type: 'number' },
|
|
@@ -57,7 +57,7 @@ const arazzoSourceDescriptionSchema = {
|
|
|
57
57
|
additionalProperties: false,
|
|
58
58
|
required: ['name', 'type', 'url'],
|
|
59
59
|
};
|
|
60
|
-
|
|
60
|
+
exports.sourceDescriptionSchema = {
|
|
61
61
|
type: 'object',
|
|
62
62
|
oneOf: [
|
|
63
63
|
openAPISourceDescriptionSchema,
|
|
@@ -67,20 +67,20 @@ const sourceDescriptionSchema = {
|
|
|
67
67
|
};
|
|
68
68
|
const sourceDescriptionsSchema = {
|
|
69
69
|
type: 'array',
|
|
70
|
-
items: sourceDescriptionSchema,
|
|
70
|
+
items: exports.sourceDescriptionSchema,
|
|
71
71
|
};
|
|
72
72
|
const extendedOperation = {
|
|
73
73
|
type: 'object',
|
|
74
74
|
properties: {
|
|
75
75
|
path: { type: 'string' },
|
|
76
|
-
method: operationMethod,
|
|
76
|
+
method: exports.operationMethod,
|
|
77
77
|
sourceDescriptionName: { type: 'string' },
|
|
78
78
|
serverUrl: { type: 'string' },
|
|
79
79
|
},
|
|
80
80
|
additionalProperties: false,
|
|
81
81
|
required: ['path', 'method'],
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
exports.parameter = {
|
|
84
84
|
type: 'object',
|
|
85
85
|
oneOf: [
|
|
86
86
|
{
|
|
@@ -95,17 +95,6 @@ const parameter = {
|
|
|
95
95
|
required: ['name', 'value'],
|
|
96
96
|
additionalProperties: false,
|
|
97
97
|
},
|
|
98
|
-
{
|
|
99
|
-
type: 'object',
|
|
100
|
-
properties: {
|
|
101
|
-
$ref: { type: 'string' },
|
|
102
|
-
value: {
|
|
103
|
-
oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }],
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
required: ['$ref'],
|
|
107
|
-
additionalProperties: false,
|
|
108
|
-
},
|
|
109
98
|
{
|
|
110
99
|
type: 'object',
|
|
111
100
|
properties: {
|
|
@@ -121,9 +110,9 @@ const parameter = {
|
|
|
121
110
|
};
|
|
122
111
|
const parameters = {
|
|
123
112
|
type: 'array',
|
|
124
|
-
items: parameter,
|
|
113
|
+
items: exports.parameter,
|
|
125
114
|
};
|
|
126
|
-
|
|
115
|
+
exports.infoObject = {
|
|
127
116
|
type: 'object',
|
|
128
117
|
properties: {
|
|
129
118
|
title: { type: 'string' },
|
|
@@ -134,7 +123,7 @@ const infoObject = {
|
|
|
134
123
|
additionalProperties: false,
|
|
135
124
|
required: ['title', 'version'],
|
|
136
125
|
};
|
|
137
|
-
|
|
126
|
+
exports.replacement = {
|
|
138
127
|
type: 'object',
|
|
139
128
|
properties: {
|
|
140
129
|
target: { type: 'string' },
|
|
@@ -149,7 +138,7 @@ const replacement = {
|
|
|
149
138
|
},
|
|
150
139
|
},
|
|
151
140
|
};
|
|
152
|
-
|
|
141
|
+
exports.requestBody = {
|
|
153
142
|
type: 'object',
|
|
154
143
|
properties: {
|
|
155
144
|
contentType: { type: 'string' },
|
|
@@ -165,13 +154,13 @@ const requestBody = {
|
|
|
165
154
|
encoding: { type: 'string' },
|
|
166
155
|
replacements: {
|
|
167
156
|
type: 'array',
|
|
168
|
-
items: replacement,
|
|
157
|
+
items: exports.replacement,
|
|
169
158
|
},
|
|
170
159
|
},
|
|
171
160
|
additionalProperties: false,
|
|
172
161
|
required: ['payload'],
|
|
173
162
|
};
|
|
174
|
-
|
|
163
|
+
exports.criteriaObject = {
|
|
175
164
|
type: 'object',
|
|
176
165
|
properties: {
|
|
177
166
|
condition: { type: 'string' },
|
|
@@ -201,9 +190,9 @@ const criteriaObject = {
|
|
|
201
190
|
};
|
|
202
191
|
const criteriaObjects = {
|
|
203
192
|
type: 'array',
|
|
204
|
-
items: criteriaObject,
|
|
193
|
+
items: exports.criteriaObject,
|
|
205
194
|
};
|
|
206
|
-
|
|
195
|
+
exports.inherit = {
|
|
207
196
|
type: 'string',
|
|
208
197
|
enum: ['auto', 'none'],
|
|
209
198
|
};
|
|
@@ -241,7 +230,7 @@ const onFailureList = {
|
|
|
241
230
|
type: 'array',
|
|
242
231
|
items: onFailureObject,
|
|
243
232
|
};
|
|
244
|
-
|
|
233
|
+
exports.step = {
|
|
245
234
|
type: 'object',
|
|
246
235
|
properties: {
|
|
247
236
|
stepId: { type: 'string' },
|
|
@@ -256,14 +245,30 @@ const step = {
|
|
|
256
245
|
outputs: {
|
|
257
246
|
type: 'object',
|
|
258
247
|
additionalProperties: {
|
|
259
|
-
|
|
248
|
+
oneOf: [
|
|
249
|
+
{
|
|
250
|
+
type: 'string',
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
type: 'object',
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
type: 'array',
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
type: 'boolean',
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
type: 'number',
|
|
263
|
+
},
|
|
264
|
+
],
|
|
260
265
|
},
|
|
261
266
|
},
|
|
262
|
-
'x-inherit': inherit,
|
|
263
|
-
'x-expect': expectSchema,
|
|
267
|
+
'x-inherit': exports.inherit,
|
|
268
|
+
'x-expect': exports.expectSchema,
|
|
264
269
|
'x-assert': { type: 'string' },
|
|
265
270
|
'x-operation': extendedOperation,
|
|
266
|
-
requestBody: requestBody,
|
|
271
|
+
requestBody: exports.requestBody,
|
|
267
272
|
},
|
|
268
273
|
required: ['stepId'],
|
|
269
274
|
oneOf: [
|
|
@@ -275,7 +280,7 @@ const step = {
|
|
|
275
280
|
};
|
|
276
281
|
const steps = {
|
|
277
282
|
type: 'array',
|
|
278
|
-
items: step,
|
|
283
|
+
items: exports.step,
|
|
279
284
|
};
|
|
280
285
|
const JSONSchema = {
|
|
281
286
|
type: 'object',
|
|
@@ -300,7 +305,7 @@ const JSONSchema = {
|
|
|
300
305
|
required: ['type'],
|
|
301
306
|
additionalProperties: true,
|
|
302
307
|
};
|
|
303
|
-
|
|
308
|
+
exports.workflow = {
|
|
304
309
|
type: 'object',
|
|
305
310
|
properties: {
|
|
306
311
|
workflowId: { type: 'string' },
|
|
@@ -330,13 +335,13 @@ const workflow = {
|
|
|
330
335
|
};
|
|
331
336
|
const workflows = {
|
|
332
337
|
type: 'array',
|
|
333
|
-
items: workflow,
|
|
338
|
+
items: exports.workflow,
|
|
334
339
|
};
|
|
335
340
|
exports.arazzoSchema = {
|
|
336
341
|
type: 'object',
|
|
337
342
|
properties: {
|
|
338
343
|
arazzo: { type: 'string', enum: ['1.0.0'] },
|
|
339
|
-
info: infoObject,
|
|
344
|
+
info: exports.infoObject,
|
|
340
345
|
sourceDescriptions: sourceDescriptionsSchema,
|
|
341
346
|
'x-parameters': parameters,
|
|
342
347
|
workflows: workflows,
|
|
@@ -362,7 +367,7 @@ exports.arazzoSchema = {
|
|
|
362
367
|
},
|
|
363
368
|
parameters: {
|
|
364
369
|
type: 'object',
|
|
365
|
-
additionalProperties: parameter,
|
|
370
|
+
additionalProperties: exports.parameter,
|
|
366
371
|
},
|
|
367
372
|
successActions: {
|
|
368
373
|
type: 'object',
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NodeType } from '.';
|
|
2
|
+
export declare const Tag: NodeType;
|
|
3
|
+
export declare const ExternalDocs: NodeType;
|
|
4
|
+
export declare const ServerMap: NodeType;
|
|
5
|
+
export declare const ServerVariable: NodeType;
|
|
6
|
+
export declare const Contact: NodeType;
|
|
7
|
+
export declare const License: NodeType;
|
|
8
|
+
export declare const CorrelationId: NodeType;
|
|
9
|
+
export declare const MessageExample: NodeType;
|
|
10
|
+
export declare const Schema: NodeType;
|
|
11
|
+
export declare const SchemaProperties: NodeType;
|
|
12
|
+
export declare const DiscriminatorMapping: NodeType;
|
|
13
|
+
export declare const Discriminator: NodeType;
|
|
14
|
+
export declare const SecuritySchemeFlows: NodeType;
|
|
15
|
+
export declare const Dependencies: NodeType;
|
|
16
|
+
export declare const AsyncApi2Bindings: Record<string, NodeType>;
|
|
17
|
+
export declare const AsyncApi2Types: Record<string, NodeType>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AsyncApi2Types = void 0;
|
|
3
|
+
exports.AsyncApi2Types = exports.AsyncApi2Bindings = exports.Dependencies = exports.SecuritySchemeFlows = exports.Discriminator = exports.DiscriminatorMapping = exports.SchemaProperties = exports.Schema = exports.MessageExample = exports.CorrelationId = exports.License = exports.Contact = exports.ServerVariable = exports.ServerMap = exports.ExternalDocs = exports.Tag = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
const ref_utils_1 = require("../ref-utils");
|
|
6
6
|
const Root = {
|
|
7
7
|
properties: {
|
|
8
|
-
asyncapi: null,
|
|
8
|
+
asyncapi: null, // TODO: validate semver format and supported version
|
|
9
9
|
info: 'Info',
|
|
10
10
|
id: { type: 'string' },
|
|
11
11
|
servers: 'ServerMap',
|
|
@@ -59,7 +59,7 @@ const ChannelBindings = {
|
|
|
59
59
|
},
|
|
60
60
|
additionalProperties: { type: 'object' },
|
|
61
61
|
};
|
|
62
|
-
|
|
62
|
+
exports.Tag = {
|
|
63
63
|
properties: {
|
|
64
64
|
name: { type: 'string' },
|
|
65
65
|
description: { type: 'string' },
|
|
@@ -67,7 +67,7 @@ const Tag = {
|
|
|
67
67
|
},
|
|
68
68
|
required: ['name'],
|
|
69
69
|
};
|
|
70
|
-
|
|
70
|
+
exports.ExternalDocs = {
|
|
71
71
|
properties: {
|
|
72
72
|
description: { type: 'string' },
|
|
73
73
|
url: { type: 'string' },
|
|
@@ -119,11 +119,11 @@ const Server = {
|
|
|
119
119
|
},
|
|
120
120
|
required: ['url', 'protocol'],
|
|
121
121
|
};
|
|
122
|
-
|
|
122
|
+
exports.ServerMap = {
|
|
123
123
|
properties: {},
|
|
124
124
|
additionalProperties: (_value, key) => key.match(/^[A-Za-z0-9_\-]+$/) ? 'Server' : undefined,
|
|
125
125
|
};
|
|
126
|
-
|
|
126
|
+
exports.ServerVariable = {
|
|
127
127
|
properties: {
|
|
128
128
|
enum: {
|
|
129
129
|
type: 'array',
|
|
@@ -149,14 +149,14 @@ const Info = {
|
|
|
149
149
|
},
|
|
150
150
|
required: ['title', 'version'],
|
|
151
151
|
};
|
|
152
|
-
|
|
152
|
+
exports.Contact = {
|
|
153
153
|
properties: {
|
|
154
154
|
name: { type: 'string' },
|
|
155
155
|
url: { type: 'string' },
|
|
156
156
|
email: { type: 'string' },
|
|
157
157
|
},
|
|
158
158
|
};
|
|
159
|
-
|
|
159
|
+
exports.License = {
|
|
160
160
|
properties: {
|
|
161
161
|
name: { type: 'string' },
|
|
162
162
|
url: { type: 'string' },
|
|
@@ -170,7 +170,7 @@ const Parameter = {
|
|
|
170
170
|
location: { type: 'string' },
|
|
171
171
|
},
|
|
172
172
|
};
|
|
173
|
-
|
|
173
|
+
exports.CorrelationId = {
|
|
174
174
|
properties: {
|
|
175
175
|
description: { type: 'string' },
|
|
176
176
|
location: { type: 'string' },
|
|
@@ -181,9 +181,9 @@ const Message = {
|
|
|
181
181
|
properties: {
|
|
182
182
|
messageId: { type: 'string' },
|
|
183
183
|
headers: 'Schema',
|
|
184
|
-
payload: 'Schema',
|
|
184
|
+
payload: 'Schema', // TODO: strictly this does not cover all cases
|
|
185
185
|
correlationId: 'CorrelationId',
|
|
186
|
-
schemaFormat: { type: 'string' },
|
|
186
|
+
schemaFormat: { type: 'string' }, // TODO: support official list of schema formats and custom values
|
|
187
187
|
contentType: { type: 'string' },
|
|
188
188
|
name: { type: 'string' },
|
|
189
189
|
title: { type: 'string' },
|
|
@@ -192,7 +192,7 @@ const Message = {
|
|
|
192
192
|
tags: 'TagList',
|
|
193
193
|
externalDocs: 'ExternalDocs',
|
|
194
194
|
bindings: 'MessageBindings',
|
|
195
|
-
|
|
195
|
+
examples: 'MessageExampleList',
|
|
196
196
|
traits: 'MessageTraitList',
|
|
197
197
|
},
|
|
198
198
|
additionalProperties: {},
|
|
@@ -279,7 +279,7 @@ const MessageTrait = {
|
|
|
279
279
|
tags: 'TagList',
|
|
280
280
|
externalDocs: 'ExternalDocs',
|
|
281
281
|
bindings: 'MessageBindings',
|
|
282
|
-
|
|
282
|
+
examples: 'MessageExampleList',
|
|
283
283
|
},
|
|
284
284
|
additionalProperties: {},
|
|
285
285
|
};
|
|
@@ -297,7 +297,7 @@ const Operation = {
|
|
|
297
297
|
},
|
|
298
298
|
required: [],
|
|
299
299
|
};
|
|
300
|
-
|
|
300
|
+
exports.MessageExample = {
|
|
301
301
|
properties: {
|
|
302
302
|
payload: { isExample: true },
|
|
303
303
|
summary: { type: 'string' },
|
|
@@ -305,14 +305,11 @@ const MessageExample = {
|
|
|
305
305
|
headers: { type: 'object' },
|
|
306
306
|
},
|
|
307
307
|
};
|
|
308
|
-
|
|
308
|
+
exports.Schema = {
|
|
309
309
|
properties: {
|
|
310
310
|
$id: { type: 'string' },
|
|
311
|
-
id: { type: 'string' },
|
|
312
311
|
$schema: { type: 'string' },
|
|
313
312
|
definitions: 'NamedSchemas',
|
|
314
|
-
$defs: 'NamedSchemas',
|
|
315
|
-
$vocabulary: { type: 'string' },
|
|
316
313
|
externalDocs: 'ExternalDocs',
|
|
317
314
|
discriminator: 'Discriminator',
|
|
318
315
|
myArbitraryKeyword: { type: 'boolean' },
|
|
@@ -333,17 +330,14 @@ const Schema = {
|
|
|
333
330
|
required: { type: 'array', items: { type: 'string' } },
|
|
334
331
|
enum: { type: 'array' },
|
|
335
332
|
type: (value) => {
|
|
336
|
-
|
|
337
|
-
|
|
333
|
+
return Array.isArray(value)
|
|
334
|
+
? {
|
|
338
335
|
type: 'array',
|
|
339
336
|
items: { enum: ['object', 'array', 'string', 'number', 'integer', 'boolean', 'null'] },
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
else {
|
|
343
|
-
return {
|
|
337
|
+
}
|
|
338
|
+
: {
|
|
344
339
|
enum: ['object', 'array', 'string', 'number', 'integer', 'boolean', 'null'],
|
|
345
340
|
};
|
|
346
|
-
}
|
|
347
341
|
},
|
|
348
342
|
allOf: (0, _1.listOf)('Schema'),
|
|
349
343
|
anyOf: (0, _1.listOf)('Schema'),
|
|
@@ -352,38 +346,12 @@ const Schema = {
|
|
|
352
346
|
if: 'Schema',
|
|
353
347
|
then: 'Schema',
|
|
354
348
|
else: 'Schema',
|
|
355
|
-
dependentSchemas: (0, _1.listOf)('Schema'),
|
|
356
|
-
prefixItems: (0, _1.listOf)('Schema'),
|
|
357
349
|
contains: 'Schema',
|
|
358
|
-
minContains: { type: 'integer', minimum: 0 },
|
|
359
|
-
maxContains: { type: 'integer', minimum: 0 },
|
|
360
350
|
patternProperties: { type: 'object' },
|
|
361
351
|
propertyNames: 'Schema',
|
|
362
|
-
unevaluatedItems: (value) => {
|
|
363
|
-
if (typeof value === 'boolean') {
|
|
364
|
-
return { type: 'boolean' };
|
|
365
|
-
}
|
|
366
|
-
else {
|
|
367
|
-
return 'Schema';
|
|
368
|
-
}
|
|
369
|
-
},
|
|
370
|
-
unevaluatedProperties: (value) => {
|
|
371
|
-
if (typeof value === 'boolean') {
|
|
372
|
-
return { type: 'boolean' };
|
|
373
|
-
}
|
|
374
|
-
else {
|
|
375
|
-
return 'Schema';
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
summary: { type: 'string' },
|
|
379
352
|
properties: 'SchemaProperties',
|
|
380
353
|
items: (value) => {
|
|
381
|
-
|
|
382
|
-
return { type: 'boolean' };
|
|
383
|
-
}
|
|
384
|
-
else {
|
|
385
|
-
return 'Schema';
|
|
386
|
-
}
|
|
354
|
+
return Array.isArray(value) ? (0, _1.listOf)('Schema') : 'Schema';
|
|
387
355
|
},
|
|
388
356
|
additionalProperties: (value) => {
|
|
389
357
|
return typeof value === 'boolean' ? { type: 'boolean' } : 'Schema';
|
|
@@ -395,25 +363,24 @@ const Schema = {
|
|
|
395
363
|
default: null,
|
|
396
364
|
readOnly: { type: 'boolean' },
|
|
397
365
|
writeOnly: { type: 'boolean' },
|
|
398
|
-
// xml: 'Xml',
|
|
399
366
|
examples: { type: 'array' },
|
|
400
367
|
example: { isExample: true },
|
|
401
368
|
deprecated: { type: 'boolean' },
|
|
402
369
|
const: null,
|
|
403
370
|
$comment: { type: 'string' },
|
|
404
|
-
|
|
371
|
+
additionalItems: (value) => {
|
|
372
|
+
return typeof value === 'boolean' ? { type: 'boolean' } : 'Schema';
|
|
373
|
+
},
|
|
374
|
+
dependencies: 'Dependencies',
|
|
405
375
|
},
|
|
406
376
|
};
|
|
407
|
-
|
|
377
|
+
exports.SchemaProperties = {
|
|
408
378
|
properties: {},
|
|
409
379
|
additionalProperties: (value) => {
|
|
410
|
-
|
|
411
|
-
return { type: 'boolean' };
|
|
412
|
-
}
|
|
413
|
-
return 'Schema';
|
|
380
|
+
return typeof value === 'boolean' ? { type: 'boolean' } : 'Schema';
|
|
414
381
|
},
|
|
415
382
|
};
|
|
416
|
-
|
|
383
|
+
exports.DiscriminatorMapping = {
|
|
417
384
|
properties: {},
|
|
418
385
|
additionalProperties: (value) => {
|
|
419
386
|
if ((0, ref_utils_1.isMappingRef)(value)) {
|
|
@@ -424,7 +391,7 @@ const DiscriminatorMapping = {
|
|
|
424
391
|
}
|
|
425
392
|
},
|
|
426
393
|
};
|
|
427
|
-
|
|
394
|
+
exports.Discriminator = {
|
|
428
395
|
properties: {
|
|
429
396
|
propertyName: { type: 'string' },
|
|
430
397
|
mapping: 'DiscriminatorMapping',
|
|
@@ -439,7 +406,6 @@ const Components = {
|
|
|
439
406
|
correlationIds: 'NamedCorrelationIds',
|
|
440
407
|
messageTraits: 'NamedMessageTraits',
|
|
441
408
|
operationTraits: 'NamedOperationTraits',
|
|
442
|
-
streamHeaders: 'NamedStreamHeaders',
|
|
443
409
|
securitySchemes: 'NamedSecuritySchemes',
|
|
444
410
|
servers: 'ServerMap',
|
|
445
411
|
serverVariables: 'ServerVariablesMap',
|
|
@@ -453,7 +419,7 @@ const Components = {
|
|
|
453
419
|
const ImplicitFlow = {
|
|
454
420
|
properties: {
|
|
455
421
|
refreshUrl: { type: 'string' },
|
|
456
|
-
scopes: { type: 'object', additionalProperties: { type: 'string' } },
|
|
422
|
+
scopes: { type: 'object', additionalProperties: { type: 'string' } }, // TODO: validate scopes
|
|
457
423
|
authorizationUrl: { type: 'string' },
|
|
458
424
|
},
|
|
459
425
|
required: ['authorizationUrl', 'scopes'],
|
|
@@ -461,7 +427,7 @@ const ImplicitFlow = {
|
|
|
461
427
|
const PasswordFlow = {
|
|
462
428
|
properties: {
|
|
463
429
|
refreshUrl: { type: 'string' },
|
|
464
|
-
scopes: { type: 'object', additionalProperties: { type: 'string' } },
|
|
430
|
+
scopes: { type: 'object', additionalProperties: { type: 'string' } }, // TODO: validate scopes
|
|
465
431
|
tokenUrl: { type: 'string' },
|
|
466
432
|
},
|
|
467
433
|
required: ['tokenUrl', 'scopes'],
|
|
@@ -469,7 +435,7 @@ const PasswordFlow = {
|
|
|
469
435
|
const ClientCredentials = {
|
|
470
436
|
properties: {
|
|
471
437
|
refreshUrl: { type: 'string' },
|
|
472
|
-
scopes: { type: 'object', additionalProperties: { type: 'string' } },
|
|
438
|
+
scopes: { type: 'object', additionalProperties: { type: 'string' } }, // TODO: validate scopes
|
|
473
439
|
tokenUrl: { type: 'string' },
|
|
474
440
|
},
|
|
475
441
|
required: ['tokenUrl', 'scopes'],
|
|
@@ -478,12 +444,12 @@ const AuthorizationCode = {
|
|
|
478
444
|
properties: {
|
|
479
445
|
refreshUrl: { type: 'string' },
|
|
480
446
|
authorizationUrl: { type: 'string' },
|
|
481
|
-
scopes: { type: 'object', additionalProperties: { type: 'string' } },
|
|
447
|
+
scopes: { type: 'object', additionalProperties: { type: 'string' } }, // TODO: validate scopes
|
|
482
448
|
tokenUrl: { type: 'string' },
|
|
483
449
|
},
|
|
484
450
|
required: ['authorizationUrl', 'tokenUrl', 'scopes'],
|
|
485
451
|
};
|
|
486
|
-
|
|
452
|
+
exports.SecuritySchemeFlows = {
|
|
487
453
|
properties: {
|
|
488
454
|
implicit: 'ImplicitFlow',
|
|
489
455
|
password: 'PasswordFlow',
|
|
@@ -519,7 +485,7 @@ const SecurityScheme = {
|
|
|
519
485
|
openIdConnectUrl: { type: 'string' },
|
|
520
486
|
},
|
|
521
487
|
required(value) {
|
|
522
|
-
switch (value
|
|
488
|
+
switch (value?.type) {
|
|
523
489
|
case 'apiKey':
|
|
524
490
|
return ['type', 'in'];
|
|
525
491
|
case 'httpApiKey':
|
|
@@ -535,7 +501,7 @@ const SecurityScheme = {
|
|
|
535
501
|
}
|
|
536
502
|
},
|
|
537
503
|
allowed(value) {
|
|
538
|
-
switch (value
|
|
504
|
+
switch (value?.type) {
|
|
539
505
|
case 'apiKey':
|
|
540
506
|
return ['type', 'in', 'description'];
|
|
541
507
|
case 'httpApiKey':
|
|
@@ -552,6 +518,12 @@ const SecurityScheme = {
|
|
|
552
518
|
},
|
|
553
519
|
extensionsPrefix: 'x-',
|
|
554
520
|
};
|
|
521
|
+
exports.Dependencies = {
|
|
522
|
+
properties: {},
|
|
523
|
+
additionalProperties: (value) => {
|
|
524
|
+
return Array.isArray(value) ? { type: 'array', items: { type: 'string' } } : 'Schema';
|
|
525
|
+
},
|
|
526
|
+
};
|
|
555
527
|
// --- Per-protocol node types
|
|
556
528
|
// http
|
|
557
529
|
const HttpChannelBinding = {
|
|
@@ -629,7 +601,7 @@ const KafkaServerBinding = {
|
|
|
629
601
|
ServerBindings.properties.kafka = KafkaServerBinding;
|
|
630
602
|
const KafkaMessageBinding = {
|
|
631
603
|
properties: {
|
|
632
|
-
key: 'Schema',
|
|
604
|
+
key: 'Schema', // TODO: add avro support
|
|
633
605
|
schemaIdLocation: { type: 'string' },
|
|
634
606
|
schemaIdPayloadEncoding: { type: 'string' },
|
|
635
607
|
schemaLookupStrategy: { type: 'string' },
|
|
@@ -693,7 +665,7 @@ const AmqpOperationBinding = {
|
|
|
693
665
|
userId: { type: 'string' },
|
|
694
666
|
cc: { type: 'array', items: { type: 'string' } },
|
|
695
667
|
priority: { type: 'integer' },
|
|
696
|
-
deliveryMode: { type: 'integer' },
|
|
668
|
+
deliveryMode: { type: 'integer' }, // TODO: enum: [1, 2]
|
|
697
669
|
mandatory: { type: 'boolean' },
|
|
698
670
|
bcc: { type: 'array', items: { type: 'string' } },
|
|
699
671
|
replyTo: { type: 'string' },
|
|
@@ -917,20 +889,7 @@ OperationBindings.properties.mercure = MercureOperationBinding;
|
|
|
917
889
|
// googlepubsub
|
|
918
890
|
// pulsar
|
|
919
891
|
// --- End per-protocol node types
|
|
920
|
-
exports.
|
|
921
|
-
Root,
|
|
922
|
-
Tag,
|
|
923
|
-
TagList: (0, _1.listOf)('Tag'),
|
|
924
|
-
ServerMap,
|
|
925
|
-
ExternalDocs,
|
|
926
|
-
Server,
|
|
927
|
-
ServerVariable,
|
|
928
|
-
ServerVariablesMap: (0, _1.mapOf)('ServerVariable'),
|
|
929
|
-
SecurityRequirement,
|
|
930
|
-
SecurityRequirementList: (0, _1.listOf)('SecurityRequirement'),
|
|
931
|
-
Info,
|
|
932
|
-
Contact,
|
|
933
|
-
License,
|
|
892
|
+
exports.AsyncApi2Bindings = {
|
|
934
893
|
HttpServerBinding,
|
|
935
894
|
HttpChannelBinding,
|
|
936
895
|
HttpMessageBinding,
|
|
@@ -992,16 +951,34 @@ exports.AsyncApi2Types = {
|
|
|
992
951
|
MercureOperationBinding,
|
|
993
952
|
ServerBindings,
|
|
994
953
|
ChannelBindings,
|
|
954
|
+
MessageBindings,
|
|
955
|
+
OperationBindings,
|
|
956
|
+
};
|
|
957
|
+
exports.AsyncApi2Types = {
|
|
958
|
+
...exports.AsyncApi2Bindings,
|
|
959
|
+
Root,
|
|
960
|
+
Tag: exports.Tag,
|
|
961
|
+
TagList: (0, _1.listOf)('Tag'),
|
|
962
|
+
ServerMap: exports.ServerMap,
|
|
963
|
+
ExternalDocs: exports.ExternalDocs,
|
|
964
|
+
Server,
|
|
965
|
+
ServerVariable: exports.ServerVariable,
|
|
966
|
+
ServerVariablesMap: (0, _1.mapOf)('ServerVariable'),
|
|
967
|
+
SecurityRequirement,
|
|
968
|
+
SecurityRequirementList: (0, _1.listOf)('SecurityRequirement'),
|
|
969
|
+
Info,
|
|
970
|
+
Contact: exports.Contact,
|
|
971
|
+
License: exports.License,
|
|
995
972
|
ChannelMap,
|
|
996
973
|
Channel,
|
|
997
974
|
Parameter,
|
|
998
975
|
ParametersMap: (0, _1.mapOf)('Parameter'),
|
|
999
976
|
Operation,
|
|
1000
|
-
Schema,
|
|
1001
|
-
MessageExample,
|
|
1002
|
-
SchemaProperties,
|
|
1003
|
-
DiscriminatorMapping,
|
|
1004
|
-
Discriminator,
|
|
977
|
+
Schema: exports.Schema,
|
|
978
|
+
MessageExample: exports.MessageExample,
|
|
979
|
+
SchemaProperties: exports.SchemaProperties,
|
|
980
|
+
DiscriminatorMapping: exports.DiscriminatorMapping,
|
|
981
|
+
Discriminator: exports.Discriminator,
|
|
1005
982
|
Components,
|
|
1006
983
|
NamedSchemas: (0, _1.mapOf)('Schema'),
|
|
1007
984
|
NamedMessages: (0, _1.mapOf)('Message'),
|
|
@@ -1010,12 +987,11 @@ exports.AsyncApi2Types = {
|
|
|
1010
987
|
NamedParameters: (0, _1.mapOf)('Parameter'),
|
|
1011
988
|
NamedSecuritySchemes: (0, _1.mapOf)('SecurityScheme'),
|
|
1012
989
|
NamedCorrelationIds: (0, _1.mapOf)('CorrelationId'),
|
|
1013
|
-
NamedStreamHeaders: (0, _1.mapOf)('StreamHeader'),
|
|
1014
990
|
ImplicitFlow,
|
|
1015
991
|
PasswordFlow,
|
|
1016
992
|
ClientCredentials,
|
|
1017
993
|
AuthorizationCode,
|
|
1018
|
-
SecuritySchemeFlows,
|
|
994
|
+
SecuritySchemeFlows: exports.SecuritySchemeFlows,
|
|
1019
995
|
SecurityScheme,
|
|
1020
996
|
Message,
|
|
1021
997
|
MessageBindings,
|
|
@@ -1024,5 +1000,7 @@ exports.AsyncApi2Types = {
|
|
|
1024
1000
|
OperationTraitList: (0, _1.listOf)('OperationTrait'),
|
|
1025
1001
|
MessageTrait,
|
|
1026
1002
|
MessageTraitList: (0, _1.listOf)('MessageTrait'),
|
|
1027
|
-
|
|
1003
|
+
MessageExampleList: (0, _1.listOf)('MessageExample'),
|
|
1004
|
+
CorrelationId: exports.CorrelationId,
|
|
1005
|
+
Dependencies: exports.Dependencies,
|
|
1028
1006
|
};
|