@redocly/openapi-core 1.0.2 → 1.2.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/lib/bundle.d.ts +2 -2
  3. package/lib/bundle.js +24 -22
  4. package/lib/config/builtIn.js +4 -0
  5. package/lib/config/config-resolvers.js +19 -6
  6. package/lib/config/config.d.ts +9 -9
  7. package/lib/config/config.js +32 -17
  8. package/lib/config/rules.d.ts +2 -2
  9. package/lib/config/types.d.ts +9 -3
  10. package/lib/format/codeframes.d.ts +1 -1
  11. package/lib/index.d.ts +1 -1
  12. package/lib/index.js +7 -6
  13. package/lib/lint.js +10 -16
  14. package/lib/oas-types.d.ts +16 -10
  15. package/lib/oas-types.js +52 -26
  16. package/lib/rules/async2/channels-kebab-case.d.ts +2 -0
  17. package/lib/rules/async2/channels-kebab-case.js +19 -0
  18. package/lib/rules/async2/index.d.ts +12 -0
  19. package/lib/rules/async2/index.js +22 -0
  20. package/lib/rules/async2/no-channel-trailing-slash.d.ts +2 -0
  21. package/lib/rules/async2/no-channel-trailing-slash.js +16 -0
  22. package/lib/rules/common/no-path-trailing-slash.js +2 -2
  23. package/lib/rules/common/scalar-property-missing-example.js +1 -1
  24. package/lib/rules/common/spec.d.ts +2 -2
  25. package/lib/rules/common/spec.js +3 -3
  26. package/lib/rules/common/tags-alphabetical.js +5 -2
  27. package/lib/rules/oas2/index.js +1 -1
  28. package/lib/rules/oas2/remove-unused-components.js +4 -1
  29. package/lib/rules/oas3/index.js +1 -1
  30. package/lib/rules/oas3/remove-unused-components.js +4 -1
  31. package/lib/rules/utils.d.ts +1 -1
  32. package/lib/types/asyncapi.d.ts +2 -0
  33. package/lib/types/asyncapi.js +1027 -0
  34. package/lib/types/portal-config-schema.d.ts +2533 -0
  35. package/lib/types/portal-config-schema.js +304 -0
  36. package/lib/types/redocly-yaml.js +26 -20
  37. package/lib/types/{config-external-schemas.d.ts → theme-config.d.ts} +140 -575
  38. package/lib/types/{config-external-schemas.js → theme-config.js} +55 -261
  39. package/lib/typings/asyncapi.d.ts +21 -0
  40. package/lib/typings/asyncapi.js +2 -0
  41. package/lib/visitors.d.ts +12 -0
  42. package/lib/walk.d.ts +3 -3
  43. package/package.json +3 -2
  44. package/src/__tests__/lint.test.ts +38 -6
  45. package/src/bundle.ts +27 -28
  46. package/src/config/__tests__/__snapshots__/config.test.ts.snap +24 -0
  47. package/src/config/__tests__/config.test.ts +15 -4
  48. package/src/config/builtIn.ts +4 -0
  49. package/src/config/config-resolvers.ts +25 -6
  50. package/src/config/config.ts +51 -27
  51. package/src/config/rules.ts +2 -2
  52. package/src/config/types.ts +14 -4
  53. package/src/index.ts +7 -1
  54. package/src/lint.ts +13 -22
  55. package/src/oas-types.ts +59 -21
  56. package/src/rules/async2/__tests__/channels-kebab-case.test.ts +141 -0
  57. package/src/rules/async2/__tests__/no-channel-trailing-slash.test.ts +97 -0
  58. package/src/rules/async2/channels-kebab-case.ts +18 -0
  59. package/src/rules/async2/index.ts +22 -0
  60. package/src/rules/async2/no-channel-trailing-slash.ts +15 -0
  61. package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +41 -0
  62. package/src/rules/common/__tests__/tags-alphabetical.test.ts +58 -0
  63. package/src/rules/common/no-path-trailing-slash.ts +2 -2
  64. package/src/rules/common/scalar-property-missing-example.ts +2 -2
  65. package/src/rules/common/spec.ts +2 -2
  66. package/src/rules/common/tags-alphabetical.ts +8 -4
  67. package/src/rules/oas2/__tests__/remove-unused-components.test.ts +155 -0
  68. package/src/rules/oas2/index.ts +2 -2
  69. package/src/rules/oas2/remove-unused-components.ts +6 -1
  70. package/src/rules/oas3/__tests__/remove-unused-components.test.ts +171 -0
  71. package/src/rules/oas3/index.ts +2 -2
  72. package/src/rules/oas3/remove-unused-components.ts +6 -1
  73. package/src/types/asyncapi.ts +1136 -0
  74. package/src/types/portal-config-schema.ts +343 -0
  75. package/src/types/redocly-yaml.ts +23 -34
  76. package/src/types/{config-external-schemas.ts → theme-config.ts} +60 -294
  77. package/src/typings/asyncapi.ts +26 -0
  78. package/src/visitors.ts +22 -0
  79. package/src/walk.ts +3 -3
  80. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,1027 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsyncApi2Types = void 0;
4
+ const _1 = require(".");
5
+ const ref_utils_1 = require("../ref-utils");
6
+ const Root = {
7
+ properties: {
8
+ asyncapi: null,
9
+ info: 'Info',
10
+ id: { type: 'string' },
11
+ servers: 'ServerMap',
12
+ channels: 'ChannelMap',
13
+ components: 'Components',
14
+ tags: 'TagList',
15
+ externalDocs: 'ExternalDocs',
16
+ defaultContentType: { type: 'string' },
17
+ },
18
+ required: ['asyncapi', 'channels', 'info'],
19
+ };
20
+ const Channel = {
21
+ properties: {
22
+ description: { type: 'string' },
23
+ subscribe: 'Operation',
24
+ publish: 'Operation',
25
+ parameters: 'ParametersMap',
26
+ bindings: 'ChannelBindings',
27
+ servers: { type: 'array', items: { type: 'string' } },
28
+ },
29
+ };
30
+ const ChannelMap = {
31
+ properties: {},
32
+ additionalProperties: 'Channel',
33
+ };
34
+ const ChannelBindings = {
35
+ properties: {},
36
+ allowed() {
37
+ // allow all supported values, not all have deep linting
38
+ return [
39
+ 'http',
40
+ 'ws',
41
+ 'kafka',
42
+ 'anypointmq',
43
+ 'amqp',
44
+ 'amqp1',
45
+ 'mqtt',
46
+ 'mqtt5',
47
+ 'nats',
48
+ 'jms',
49
+ 'sns',
50
+ 'solace',
51
+ 'sqs',
52
+ 'stomp',
53
+ 'redis',
54
+ 'mercure',
55
+ 'ibmmq',
56
+ 'googlepubsub',
57
+ 'pulsar',
58
+ ];
59
+ },
60
+ additionalProperties: { type: 'object' },
61
+ };
62
+ const Tag = {
63
+ properties: {
64
+ name: { type: 'string' },
65
+ description: { type: 'string' },
66
+ externalDocs: 'ExternalDocs',
67
+ },
68
+ required: ['name'],
69
+ };
70
+ const ExternalDocs = {
71
+ properties: {
72
+ description: { type: 'string' },
73
+ url: { type: 'string' },
74
+ },
75
+ required: ['url'],
76
+ };
77
+ const SecurityRequirement = {
78
+ properties: {},
79
+ additionalProperties: { type: 'array', items: { type: 'string' } },
80
+ };
81
+ const ServerBindings = {
82
+ properties: {},
83
+ allowed() {
84
+ // allow all supported values, not all have deep linting
85
+ return [
86
+ 'http',
87
+ 'ws',
88
+ 'kafka',
89
+ 'anypointmq',
90
+ 'amqp',
91
+ 'amqp1',
92
+ 'mqtt',
93
+ 'mqtt5',
94
+ 'nats',
95
+ 'jms',
96
+ 'sns',
97
+ 'solace',
98
+ 'sqs',
99
+ 'stomp',
100
+ 'redis',
101
+ 'mercure',
102
+ 'ibmmq',
103
+ 'googlepubsub',
104
+ 'pulsar',
105
+ ];
106
+ },
107
+ additionalProperties: { type: 'object' },
108
+ };
109
+ const Server = {
110
+ properties: {
111
+ url: { type: 'string' },
112
+ protocol: { type: 'string' },
113
+ protocolVersion: { type: 'string' },
114
+ description: { type: 'string' },
115
+ variables: 'ServerVariablesMap',
116
+ security: 'SecurityRequirementList',
117
+ bindings: 'ServerBindings',
118
+ tags: 'TagList',
119
+ },
120
+ required: ['url', 'protocol'],
121
+ };
122
+ const ServerMap = {
123
+ properties: {},
124
+ additionalProperties: (_value, key) => key.match(/^[A-Za-z0-9_\-]+$/) ? 'Server' : undefined,
125
+ };
126
+ const ServerVariable = {
127
+ properties: {
128
+ enum: {
129
+ type: 'array',
130
+ items: { type: 'string' },
131
+ },
132
+ default: { type: 'string' },
133
+ description: { type: 'string' },
134
+ examples: {
135
+ type: 'array',
136
+ items: { type: 'string' },
137
+ },
138
+ },
139
+ required: [],
140
+ };
141
+ const Info = {
142
+ properties: {
143
+ title: { type: 'string' },
144
+ version: { type: 'string' },
145
+ description: { type: 'string' },
146
+ termsOfService: { type: 'string' },
147
+ contact: 'Contact',
148
+ license: 'License',
149
+ },
150
+ required: ['title', 'version'],
151
+ };
152
+ const Contact = {
153
+ properties: {
154
+ name: { type: 'string' },
155
+ url: { type: 'string' },
156
+ email: { type: 'string' },
157
+ },
158
+ };
159
+ const License = {
160
+ properties: {
161
+ name: { type: 'string' },
162
+ url: { type: 'string' },
163
+ },
164
+ required: ['name'],
165
+ };
166
+ const Parameter = {
167
+ properties: {
168
+ description: { type: 'string' },
169
+ schema: 'Schema',
170
+ location: { type: 'string' },
171
+ },
172
+ };
173
+ const CorrelationId = {
174
+ properties: {
175
+ description: { type: 'string' },
176
+ location: { type: 'string' },
177
+ },
178
+ required: ['location'],
179
+ };
180
+ const Message = {
181
+ properties: {
182
+ messageId: { type: 'string' },
183
+ headers: 'Schema',
184
+ payload: 'Schema',
185
+ correlationId: 'CorrelationId',
186
+ schemaFormat: { type: 'string' },
187
+ contentType: { type: 'string' },
188
+ name: { type: 'string' },
189
+ title: { type: 'string' },
190
+ summary: { type: 'string' },
191
+ description: { type: 'string' },
192
+ tags: 'TagList',
193
+ externalDocs: 'ExternalDocs',
194
+ bindings: 'MessageBindings',
195
+ // examples: 'MessageExampleList', // TODO: add support for message examples
196
+ traits: 'MessageTraitList',
197
+ },
198
+ additionalProperties: {},
199
+ };
200
+ const MessageBindings = {
201
+ properties: {},
202
+ allowed() {
203
+ // allow all supported values, not all have deep linting
204
+ return [
205
+ 'http',
206
+ 'ws',
207
+ 'kafka',
208
+ 'anypointmq',
209
+ 'amqp',
210
+ 'amqp1',
211
+ 'mqtt',
212
+ 'mqtt5',
213
+ 'nats',
214
+ 'jms',
215
+ 'sns',
216
+ 'solace',
217
+ 'sqs',
218
+ 'stomp',
219
+ 'redis',
220
+ 'mercure',
221
+ 'ibmmq',
222
+ 'googlepubsub',
223
+ 'pulsar',
224
+ ];
225
+ },
226
+ additionalProperties: { type: 'object' },
227
+ };
228
+ const OperationBindings = {
229
+ properties: {},
230
+ allowed() {
231
+ // allow all supported values, not all have deep linting
232
+ return [
233
+ 'http',
234
+ 'ws',
235
+ 'kafka',
236
+ 'anypointmq',
237
+ 'amqp',
238
+ 'amqp1',
239
+ 'mqtt',
240
+ 'mqtt5',
241
+ 'nats',
242
+ 'jms',
243
+ 'sns',
244
+ 'solace',
245
+ 'sqs',
246
+ 'stomp',
247
+ 'redis',
248
+ 'mercure',
249
+ 'ibmmq',
250
+ 'googlepubsub',
251
+ 'pulsar',
252
+ ];
253
+ },
254
+ additionalProperties: { type: 'object' },
255
+ };
256
+ const OperationTrait = {
257
+ properties: {
258
+ tags: {
259
+ type: 'array',
260
+ items: { type: 'string' },
261
+ },
262
+ summary: { type: 'string' },
263
+ description: { type: 'string' },
264
+ externalDocs: 'ExternalDocs',
265
+ operationId: { type: 'string' },
266
+ security: 'SecurityRequirementList',
267
+ bindings: 'OperationBindings',
268
+ },
269
+ required: [],
270
+ };
271
+ const MessageTrait = {
272
+ properties: {
273
+ messageId: { type: 'string' },
274
+ headers: 'Schema',
275
+ correlationId: 'CorrelationId',
276
+ schemaFormat: { type: 'string' },
277
+ contentType: { type: 'string' },
278
+ name: { type: 'string' },
279
+ title: { type: 'string' },
280
+ summary: { type: 'string' },
281
+ description: { type: 'string' },
282
+ tags: 'TagList',
283
+ externalDocs: 'ExternalDocs',
284
+ bindings: 'MessageBindings',
285
+ // examples: 'MessageExampleList', // TODO: support examples for message traits
286
+ },
287
+ additionalProperties: {},
288
+ };
289
+ const Operation = {
290
+ properties: {
291
+ tags: {
292
+ type: 'array',
293
+ items: { type: 'string' },
294
+ },
295
+ summary: { type: 'string' },
296
+ description: { type: 'string' },
297
+ externalDocs: 'ExternalDocs',
298
+ operationId: { type: 'string' },
299
+ security: 'SecurityRequirementList',
300
+ bindings: 'OperationBindings',
301
+ traits: 'OperationTraitList',
302
+ message: 'Message',
303
+ },
304
+ required: [],
305
+ };
306
+ const MessageExample = {
307
+ properties: {
308
+ payload: { isExample: true },
309
+ summary: { type: 'string' },
310
+ name: { type: 'string' },
311
+ headers: { type: 'object' },
312
+ },
313
+ };
314
+ const Schema = {
315
+ properties: {
316
+ $id: { type: 'string' },
317
+ id: { type: 'string' },
318
+ $schema: { type: 'string' },
319
+ definitions: 'NamedSchemas',
320
+ $defs: 'NamedSchemas',
321
+ $vocabulary: { type: 'string' },
322
+ externalDocs: 'ExternalDocs',
323
+ discriminator: 'Discriminator',
324
+ myArbitraryKeyword: { type: 'boolean' },
325
+ title: { type: 'string' },
326
+ multipleOf: { type: 'number', minimum: 0 },
327
+ maximum: { type: 'number' },
328
+ minimum: { type: 'number' },
329
+ exclusiveMaximum: { type: 'number' },
330
+ exclusiveMinimum: { type: 'number' },
331
+ maxLength: { type: 'integer', minimum: 0 },
332
+ minLength: { type: 'integer', minimum: 0 },
333
+ pattern: { type: 'string' },
334
+ maxItems: { type: 'integer', minimum: 0 },
335
+ minItems: { type: 'integer', minimum: 0 },
336
+ uniqueItems: { type: 'boolean' },
337
+ maxProperties: { type: 'integer', minimum: 0 },
338
+ minProperties: { type: 'integer', minimum: 0 },
339
+ required: { type: 'array', items: { type: 'string' } },
340
+ enum: { type: 'array' },
341
+ type: (value) => {
342
+ if (Array.isArray(value)) {
343
+ return {
344
+ type: 'array',
345
+ items: { enum: ['object', 'array', 'string', 'number', 'integer', 'boolean', 'null'] },
346
+ };
347
+ }
348
+ else {
349
+ return {
350
+ enum: ['object', 'array', 'string', 'number', 'integer', 'boolean', 'null'],
351
+ };
352
+ }
353
+ },
354
+ allOf: _1.listOf('Schema'),
355
+ anyOf: _1.listOf('Schema'),
356
+ oneOf: _1.listOf('Schema'),
357
+ not: 'Schema',
358
+ if: 'Schema',
359
+ then: 'Schema',
360
+ else: 'Schema',
361
+ dependentSchemas: _1.listOf('Schema'),
362
+ prefixItems: _1.listOf('Schema'),
363
+ contains: 'Schema',
364
+ minContains: { type: 'integer', minimum: 0 },
365
+ maxContains: { type: 'integer', minimum: 0 },
366
+ patternProperties: { type: 'object' },
367
+ propertyNames: 'Schema',
368
+ unevaluatedItems: 'Schema',
369
+ unevaluatedProperties: (value) => {
370
+ if (typeof value === 'boolean') {
371
+ return { type: 'boolean' };
372
+ }
373
+ else {
374
+ return 'Schema';
375
+ }
376
+ },
377
+ summary: { type: 'string' },
378
+ properties: 'SchemaProperties',
379
+ items: (value) => {
380
+ if (typeof value === 'boolean') {
381
+ return { type: 'boolean' };
382
+ }
383
+ else {
384
+ return 'Schema';
385
+ }
386
+ },
387
+ additionalProperties: (value) => {
388
+ return typeof value === 'boolean' ? { type: 'boolean' } : 'Schema';
389
+ },
390
+ description: { type: 'string' },
391
+ format: { type: 'string' },
392
+ contentEncoding: { type: 'string' },
393
+ contentMediaType: { type: 'string' },
394
+ default: null,
395
+ readOnly: { type: 'boolean' },
396
+ writeOnly: { type: 'boolean' },
397
+ // xml: 'Xml',
398
+ examples: { type: 'array' },
399
+ example: { isExample: true },
400
+ deprecated: { type: 'boolean' },
401
+ const: null,
402
+ $comment: { type: 'string' },
403
+ dependencies: { type: 'object' }, // TODO
404
+ },
405
+ };
406
+ const SchemaProperties = {
407
+ properties: {},
408
+ additionalProperties: (value) => {
409
+ if (typeof value === 'boolean') {
410
+ return { type: 'boolean' };
411
+ }
412
+ return 'Schema';
413
+ },
414
+ };
415
+ const DiscriminatorMapping = {
416
+ properties: {},
417
+ additionalProperties: (value) => {
418
+ if (ref_utils_1.isMappingRef(value)) {
419
+ return { type: 'string', directResolveAs: 'Schema' };
420
+ }
421
+ else {
422
+ return { type: 'string' };
423
+ }
424
+ },
425
+ };
426
+ const Discriminator = {
427
+ properties: {
428
+ propertyName: { type: 'string' },
429
+ mapping: 'DiscriminatorMapping',
430
+ },
431
+ required: ['propertyName'],
432
+ };
433
+ const Components = {
434
+ properties: {
435
+ messages: 'NamedMessages',
436
+ parameters: 'NamedParameters',
437
+ schemas: 'NamedSchemas',
438
+ correlationIds: 'NamedCorrelationIds',
439
+ messageTraits: 'NamedMessageTraits',
440
+ operationTraits: 'NamedOperationTraits',
441
+ streamHeaders: 'NamedStreamHeaders',
442
+ securitySchemes: 'NamedSecuritySchemes',
443
+ servers: 'ServerMap',
444
+ serverVariables: 'ServerVariablesMap',
445
+ channels: 'ChannelMap',
446
+ serverBindings: 'ServerBindings',
447
+ channelBindings: 'ChannelBindings',
448
+ operationBindings: 'OperationBindings',
449
+ messageBindings: 'MessageBindings',
450
+ },
451
+ };
452
+ const ImplicitFlow = {
453
+ properties: {
454
+ refreshUrl: { type: 'string' },
455
+ scopes: { type: 'object', additionalProperties: { type: 'string' } },
456
+ authorizationUrl: { type: 'string' },
457
+ },
458
+ required: ['authorizationUrl', 'scopes'],
459
+ };
460
+ const PasswordFlow = {
461
+ properties: {
462
+ refreshUrl: { type: 'string' },
463
+ scopes: { type: 'object', additionalProperties: { type: 'string' } },
464
+ tokenUrl: { type: 'string' },
465
+ },
466
+ required: ['tokenUrl', 'scopes'],
467
+ };
468
+ const ClientCredentials = {
469
+ properties: {
470
+ refreshUrl: { type: 'string' },
471
+ scopes: { type: 'object', additionalProperties: { type: 'string' } },
472
+ tokenUrl: { type: 'string' },
473
+ },
474
+ required: ['tokenUrl', 'scopes'],
475
+ };
476
+ const AuthorizationCode = {
477
+ properties: {
478
+ refreshUrl: { type: 'string' },
479
+ authorizationUrl: { type: 'string' },
480
+ scopes: { type: 'object', additionalProperties: { type: 'string' } },
481
+ tokenUrl: { type: 'string' },
482
+ },
483
+ required: ['authorizationUrl', 'tokenUrl', 'scopes'],
484
+ };
485
+ const SecuritySchemeFlows = {
486
+ properties: {
487
+ implicit: 'ImplicitFlow',
488
+ password: 'PasswordFlow',
489
+ clientCredentials: 'ClientCredentials',
490
+ authorizationCode: 'AuthorizationCode',
491
+ },
492
+ };
493
+ const SecurityScheme = {
494
+ properties: {
495
+ type: {
496
+ enum: [
497
+ 'userPassword',
498
+ 'apiKey',
499
+ 'X509',
500
+ 'symmetricEncryption',
501
+ 'asymmetricEncryption',
502
+ 'httpApiKey',
503
+ 'http',
504
+ 'oauth2',
505
+ 'openIdConnect',
506
+ 'plain',
507
+ 'scramSha256',
508
+ 'scramSha512',
509
+ 'gssapi',
510
+ ],
511
+ },
512
+ description: { type: 'string' },
513
+ name: { type: 'string' },
514
+ in: { type: 'string', enum: ['query', 'header', 'cookie', 'user', 'password'] },
515
+ scheme: { type: 'string' },
516
+ bearerFormat: { type: 'string' },
517
+ flows: 'SecuritySchemeFlows',
518
+ openIdConnectUrl: { type: 'string' },
519
+ },
520
+ required(value) {
521
+ switch (value === null || value === void 0 ? void 0 : value.type) {
522
+ case 'apiKey':
523
+ return ['type', 'in'];
524
+ case 'httpApiKey':
525
+ return ['type', 'name', 'in'];
526
+ case 'http':
527
+ return ['type', 'scheme'];
528
+ case 'oauth2':
529
+ return ['type', 'flows'];
530
+ case 'openIdConnect':
531
+ return ['type', 'openIdConnectUrl'];
532
+ default:
533
+ return ['type'];
534
+ }
535
+ },
536
+ allowed(value) {
537
+ switch (value === null || value === void 0 ? void 0 : value.type) {
538
+ case 'apiKey':
539
+ return ['type', 'in', 'description'];
540
+ case 'httpApiKey':
541
+ return ['type', 'name', 'in', 'description'];
542
+ case 'http':
543
+ return ['type', 'scheme', 'bearerFormat', 'description'];
544
+ case 'oauth2':
545
+ return ['type', 'flows', 'description'];
546
+ case 'openIdConnect':
547
+ return ['type', 'openIdConnectUrl', 'description'];
548
+ default:
549
+ return ['type', 'description'];
550
+ }
551
+ },
552
+ extensionsPrefix: 'x-',
553
+ };
554
+ // --- Per-protocol node types
555
+ // http
556
+ const HttpChannelBinding = {
557
+ properties: {}, // empty object
558
+ };
559
+ ChannelBindings.properties.http = HttpChannelBinding;
560
+ const HttpServerBinding = {
561
+ properties: {}, // empty object
562
+ };
563
+ ServerBindings.properties.http = HttpServerBinding;
564
+ const HttpMessageBinding = {
565
+ properties: {
566
+ headers: 'Schema',
567
+ bindingVersion: { type: 'string' },
568
+ },
569
+ };
570
+ MessageBindings.properties.http = HttpMessageBinding;
571
+ const HttpOperationBinding = {
572
+ properties: {
573
+ type: { type: 'string' },
574
+ method: {
575
+ type: 'string',
576
+ enum: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS', 'CONNECT', 'TRACE'],
577
+ },
578
+ headers: 'Schema',
579
+ bindingVersion: { type: 'string' },
580
+ },
581
+ };
582
+ OperationBindings.properties.http = HttpOperationBinding;
583
+ // ws
584
+ const WsChannelBinding = {
585
+ properties: {
586
+ method: { type: 'string' },
587
+ query: 'Schema',
588
+ headers: 'Schema',
589
+ bindingVersion: { type: 'string' },
590
+ },
591
+ };
592
+ ChannelBindings.properties.ws = WsChannelBinding;
593
+ const WsServerBinding = {
594
+ properties: {}, // empty object
595
+ };
596
+ ServerBindings.properties.ws = WsServerBinding;
597
+ const WsMessageBinding = {
598
+ properties: {}, // empty object
599
+ };
600
+ MessageBindings.properties.ws = WsMessageBinding;
601
+ const WsOperationBinding = {
602
+ properties: {}, // empty object
603
+ };
604
+ OperationBindings.properties.ws = WsOperationBinding;
605
+ // kafka
606
+ const KafkaTopicConfiguration = {
607
+ properties: {
608
+ 'cleanup.policy': { type: 'array', items: { enum: ['delete', 'compact'] } },
609
+ 'retention.ms': { type: 'integer' },
610
+ 'retention.bytes': { type: 'integer' },
611
+ 'delete.retention.ms': { type: 'integer' },
612
+ 'max.message.bytes': { type: 'integer' },
613
+ },
614
+ };
615
+ const KafkaChannelBinding = {
616
+ properties: {
617
+ topic: { type: 'string' },
618
+ partitions: { type: 'integer' },
619
+ replicas: { type: 'integer' },
620
+ topicConfiguration: 'KafkaTopicConfiguration',
621
+ bindingVersion: { type: 'string' },
622
+ },
623
+ };
624
+ ChannelBindings.properties.kafka = KafkaChannelBinding;
625
+ const KafkaServerBinding = {
626
+ properties: {}, // empty object
627
+ };
628
+ ServerBindings.properties.kafka = KafkaServerBinding;
629
+ const KafkaMessageBinding = {
630
+ properties: {
631
+ key: 'Schema',
632
+ schemaIdLocation: { type: 'string' },
633
+ schemaIdPayloadEncoding: { type: 'string' },
634
+ schemaLookupStrategy: { type: 'string' },
635
+ bindingVersion: { type: 'string' },
636
+ },
637
+ };
638
+ MessageBindings.properties.kafka = KafkaMessageBinding;
639
+ const KafkaOperationBinding = {
640
+ properties: {
641
+ groupId: 'Schema',
642
+ clientId: 'Schema',
643
+ bindingVersion: { type: 'string' },
644
+ },
645
+ };
646
+ OperationBindings.properties.kafka = KafkaOperationBinding;
647
+ // anypointmq
648
+ const AnypointmqChannelBinding = {
649
+ properties: {
650
+ destination: { type: 'string' },
651
+ destinationType: { type: 'string' },
652
+ bindingVersion: { type: 'string' },
653
+ },
654
+ };
655
+ ChannelBindings.properties.anypointmq = AnypointmqChannelBinding;
656
+ const AnypointmqServerBinding = {
657
+ properties: {}, // empty object
658
+ };
659
+ ServerBindings.properties.anypointmq = AnypointmqServerBinding;
660
+ const AnypointmqMessageBinding = {
661
+ properties: {
662
+ headers: 'Schema',
663
+ bindingVersion: { type: 'string' },
664
+ },
665
+ };
666
+ MessageBindings.properties.anypointmq = AnypointmqMessageBinding;
667
+ const AnypointmqOperationBinding = {
668
+ properties: {}, // empty object
669
+ };
670
+ OperationBindings.properties.anypointmq = AnypointmqOperationBinding;
671
+ // amqp
672
+ const AmqpChannelBinding = {
673
+ properties: {}, // empty object
674
+ };
675
+ ChannelBindings.properties.amqp = AmqpChannelBinding;
676
+ const AmqpServerBinding = {
677
+ properties: {}, // empty object
678
+ };
679
+ ServerBindings.properties.amqp = AmqpServerBinding;
680
+ const AmqpMessageBinding = {
681
+ properties: {
682
+ contentEncoding: { type: 'string' },
683
+ messageType: { type: 'string' },
684
+ bindingVersion: { type: 'string' },
685
+ },
686
+ };
687
+ MessageBindings.properties.amqp = AmqpMessageBinding;
688
+ const AmqpOperationBinding = {
689
+ // TODO: some fields are subscribe only
690
+ properties: {
691
+ expiration: { type: 'integer' },
692
+ userId: { type: 'string' },
693
+ cc: { type: 'array', items: { type: 'string' } },
694
+ priority: { type: 'integer' },
695
+ deliveryMode: { type: 'integer' },
696
+ mandatory: { type: 'boolean' },
697
+ bcc: { type: 'array', items: { type: 'string' } },
698
+ replyTo: { type: 'string' },
699
+ timestamp: { type: 'boolean' },
700
+ ack: { type: 'boolean' },
701
+ bindingVersion: { type: 'string' },
702
+ },
703
+ };
704
+ OperationBindings.properties.amqp = AmqpOperationBinding;
705
+ // amqp1
706
+ const Amqp1ChannelBinding = {
707
+ properties: {}, // empty object
708
+ };
709
+ ChannelBindings.properties.amqp1 = Amqp1ChannelBinding;
710
+ const Amqp1ServerBinding = {
711
+ properties: {}, // empty object
712
+ };
713
+ ServerBindings.properties.amqp1 = Amqp1ServerBinding;
714
+ const Amqp1MessageBinding = {
715
+ properties: {}, // empty object
716
+ };
717
+ MessageBindings.properties.amqp1 = Amqp1MessageBinding;
718
+ const Amqp1OperationBinding = {
719
+ properties: {}, // empty object
720
+ };
721
+ OperationBindings.properties.amqp1 = Amqp1OperationBinding;
722
+ // mqtt
723
+ const MqttChannelBinding = {
724
+ properties: {
725
+ qos: { type: 'integer' },
726
+ retain: { type: 'boolean' },
727
+ bindingVersion: { type: 'string' },
728
+ },
729
+ };
730
+ ChannelBindings.properties.mqtt = MqttChannelBinding;
731
+ const MqttServerBindingLastWill = {
732
+ properties: {
733
+ topic: { type: 'string' },
734
+ qos: { type: 'integer' },
735
+ message: { type: 'string' },
736
+ retain: { type: 'boolean' },
737
+ },
738
+ };
739
+ const MqttServerBinding = {
740
+ properties: {
741
+ clientId: { type: 'string' },
742
+ cleanSession: { type: 'boolean' },
743
+ lastWill: 'MqttServerBindingLastWill',
744
+ keepAlive: { type: 'integer' },
745
+ bindingVersion: { type: 'string' },
746
+ },
747
+ };
748
+ ServerBindings.properties.mqtt = MqttServerBinding;
749
+ const MqttMessageBinding = {
750
+ properties: {
751
+ bindingVersion: { type: 'string' },
752
+ },
753
+ };
754
+ MessageBindings.properties.mqtt = MqttMessageBinding;
755
+ const MqttOperationBinding = {
756
+ properties: {
757
+ qos: { type: 'integer' },
758
+ retain: { type: 'boolean' },
759
+ bindingVersion: { type: 'string' },
760
+ },
761
+ };
762
+ OperationBindings.properties.mqtt = MqttOperationBinding;
763
+ // mqtt5
764
+ const Mqtt5ChannelBinding = {
765
+ properties: {}, // empty object
766
+ };
767
+ ChannelBindings.properties.mqtt5 = Mqtt5ChannelBinding;
768
+ const Mqtt5ServerBinding = {
769
+ properties: {}, // empty object
770
+ };
771
+ ServerBindings.properties.mqtt5 = Mqtt5ServerBinding;
772
+ const Mqtt5MessageBinding = {
773
+ properties: {}, // empty object
774
+ };
775
+ MessageBindings.properties.mqtt5 = Mqtt5MessageBinding;
776
+ const Mqtt5OperationBinding = {
777
+ properties: {}, // empty object
778
+ };
779
+ OperationBindings.properties.mqtt5 = Mqtt5OperationBinding;
780
+ // nats
781
+ const NatsChannelBinding = {
782
+ properties: {}, // empty object
783
+ };
784
+ ChannelBindings.properties.nats = NatsChannelBinding;
785
+ const NatsServerBinding = {
786
+ properties: {}, // empty object
787
+ };
788
+ ServerBindings.properties.nats = NatsServerBinding;
789
+ const NatsMessageBinding = {
790
+ properties: {}, // empty object
791
+ };
792
+ MessageBindings.properties.nats = NatsMessageBinding;
793
+ const NatsOperationBinding = {
794
+ properties: {
795
+ queue: { type: 'string' },
796
+ bindingVersion: { type: 'string' },
797
+ },
798
+ };
799
+ OperationBindings.properties.nats = NatsOperationBinding;
800
+ // jms
801
+ const JmsChannelBinding = {
802
+ properties: {
803
+ destination: { type: 'string' },
804
+ destinationType: { type: 'string' },
805
+ bindingVersion: { type: 'string' },
806
+ },
807
+ };
808
+ ChannelBindings.properties.jms = JmsChannelBinding;
809
+ const JmsServerBinding = {
810
+ properties: {}, // empty object
811
+ };
812
+ ServerBindings.properties.jms = JmsServerBinding;
813
+ const JmsMessageBinding = {
814
+ properties: {
815
+ headers: 'Schema',
816
+ bindingVersion: { type: 'string' },
817
+ },
818
+ };
819
+ MessageBindings.properties.jms = JmsMessageBinding;
820
+ const JmsOperationBinding = {
821
+ properties: {
822
+ headers: 'Schema',
823
+ bindingVersion: { type: 'string' },
824
+ },
825
+ };
826
+ OperationBindings.properties.jms = JmsOperationBinding;
827
+ // sns
828
+ // solace
829
+ const SolaceChannelBinding = {
830
+ properties: {}, // empty object
831
+ };
832
+ ChannelBindings.properties.solace = SolaceChannelBinding;
833
+ const SolaceServerBinding = {
834
+ properties: {
835
+ bindingVersion: { type: 'string' },
836
+ msgVpn: { type: 'string' },
837
+ },
838
+ };
839
+ ServerBindings.properties.solace = SolaceServerBinding;
840
+ const SolaceMessageBinding = {
841
+ properties: {}, // empty object
842
+ };
843
+ MessageBindings.properties.solace = SolaceMessageBinding;
844
+ const SolaceDestination = {
845
+ properties: {
846
+ destinationType: { type: 'string', enum: ['queue', 'topic'] },
847
+ deliveryMode: { type: 'string', enum: ['direct', 'persistent'] },
848
+ 'queue.name': { type: 'string' },
849
+ 'queue.topicSubscriptions': { type: 'array', items: { type: 'string' } },
850
+ 'queue.accessType': { type: 'string', enum: ['exclusive', 'nonexclusive'] },
851
+ 'queue.maxMsgSpoolSize': { type: 'string' },
852
+ 'queue.maxTtl': { type: 'string' },
853
+ 'topic.topicSubscriptions': { type: 'array', items: { type: 'string' } },
854
+ },
855
+ };
856
+ const SolaceOperationBinding = {
857
+ properties: {
858
+ bindingVersion: { type: 'string' },
859
+ destinations: _1.listOf('SolaceDestination'),
860
+ },
861
+ };
862
+ OperationBindings.properties.solace = SolaceOperationBinding;
863
+ // sqs
864
+ // stomp
865
+ const StompChannelBinding = {
866
+ properties: {}, // empty object
867
+ };
868
+ ChannelBindings.properties.stomp = StompChannelBinding;
869
+ const StompServerBinding = {
870
+ properties: {}, // empty object
871
+ };
872
+ ServerBindings.properties.stomp = StompServerBinding;
873
+ const StompMessageBinding = {
874
+ properties: {}, // empty object
875
+ };
876
+ MessageBindings.properties.stomp = StompMessageBinding;
877
+ const StompOperationBinding = {
878
+ properties: {}, // empty object
879
+ };
880
+ OperationBindings.properties.stomp = StompOperationBinding;
881
+ // redis
882
+ const RedisChannelBinding = {
883
+ properties: {}, // empty object
884
+ };
885
+ ChannelBindings.properties.redis = RedisChannelBinding;
886
+ const RedisServerBinding = {
887
+ properties: {}, // empty object
888
+ };
889
+ ServerBindings.properties.redis = RedisServerBinding;
890
+ const RedisMessageBinding = {
891
+ properties: {}, // empty object
892
+ };
893
+ MessageBindings.properties.redis = RedisMessageBinding;
894
+ const RedisOperationBinding = {
895
+ properties: {}, // empty object
896
+ };
897
+ OperationBindings.properties.redis = RedisOperationBinding;
898
+ // mercure
899
+ const MercureChannelBinding = {
900
+ properties: {}, // empty object
901
+ };
902
+ ChannelBindings.properties.mercure = MercureChannelBinding;
903
+ const MercureServerBinding = {
904
+ properties: {}, // empty object
905
+ };
906
+ ServerBindings.properties.mercure = MercureServerBinding;
907
+ const MercureMessageBinding = {
908
+ properties: {}, // empty object
909
+ };
910
+ MessageBindings.properties.mercure = MercureMessageBinding;
911
+ const MercureOperationBinding = {
912
+ properties: {}, // empty object
913
+ };
914
+ OperationBindings.properties.mercure = MercureOperationBinding;
915
+ // ibmmq
916
+ // googlepubsub
917
+ // pulsar
918
+ // --- End per-protocol node types
919
+ exports.AsyncApi2Types = {
920
+ Root,
921
+ Tag,
922
+ TagList: _1.listOf('Tag'),
923
+ ServerMap,
924
+ ExternalDocs,
925
+ Server,
926
+ ServerVariable,
927
+ ServerVariablesMap: _1.mapOf('ServerVariable'),
928
+ SecurityRequirement,
929
+ SecurityRequirementList: _1.listOf('SecurityRequirement'),
930
+ Info,
931
+ Contact,
932
+ License,
933
+ HttpServerBinding,
934
+ HttpChannelBinding,
935
+ HttpMessageBinding,
936
+ HttpOperationBinding,
937
+ WsServerBinding,
938
+ WsChannelBinding,
939
+ WsMessageBinding,
940
+ WsOperationBinding,
941
+ KafkaServerBinding,
942
+ KafkaTopicConfiguration,
943
+ KafkaChannelBinding,
944
+ KafkaMessageBinding,
945
+ KafkaOperationBinding,
946
+ AnypointmqServerBinding,
947
+ AnypointmqChannelBinding,
948
+ AnypointmqMessageBinding,
949
+ AnypointmqOperationBinding,
950
+ AmqpServerBinding,
951
+ AmqpChannelBinding,
952
+ AmqpMessageBinding,
953
+ AmqpOperationBinding,
954
+ Amqp1ServerBinding,
955
+ Amqp1ChannelBinding,
956
+ Amqp1MessageBinding,
957
+ Amqp1OperationBinding,
958
+ MqttServerBindingLastWill,
959
+ MqttServerBinding,
960
+ MqttChannelBinding,
961
+ MqttMessageBinding,
962
+ MqttOperationBinding,
963
+ Mqtt5ServerBinding,
964
+ Mqtt5ChannelBinding,
965
+ Mqtt5MessageBinding,
966
+ Mqtt5OperationBinding,
967
+ NatsServerBinding,
968
+ NatsChannelBinding,
969
+ NatsMessageBinding,
970
+ NatsOperationBinding,
971
+ JmsServerBinding,
972
+ JmsChannelBinding,
973
+ JmsMessageBinding,
974
+ JmsOperationBinding,
975
+ SolaceServerBinding,
976
+ SolaceChannelBinding,
977
+ SolaceMessageBinding,
978
+ SolaceDestination,
979
+ SolaceOperationBinding,
980
+ StompServerBinding,
981
+ StompChannelBinding,
982
+ StompMessageBinding,
983
+ StompOperationBinding,
984
+ RedisServerBinding,
985
+ RedisChannelBinding,
986
+ RedisMessageBinding,
987
+ RedisOperationBinding,
988
+ MercureServerBinding,
989
+ MercureChannelBinding,
990
+ MercureMessageBinding,
991
+ MercureOperationBinding,
992
+ ServerBindings,
993
+ ChannelBindings,
994
+ ChannelMap,
995
+ Channel,
996
+ Parameter,
997
+ ParametersMap: _1.mapOf('Parameter'),
998
+ Operation,
999
+ Schema,
1000
+ MessageExample,
1001
+ SchemaProperties,
1002
+ DiscriminatorMapping,
1003
+ Discriminator,
1004
+ Components,
1005
+ NamedSchemas: _1.mapOf('Schema'),
1006
+ NamedMessages: _1.mapOf('Message'),
1007
+ NamedMessageTraits: _1.mapOf('MessageTrait'),
1008
+ NamedOperationTraits: _1.mapOf('OperationTrait'),
1009
+ NamedParameters: _1.mapOf('Parameter'),
1010
+ NamedSecuritySchemes: _1.mapOf('SecurityScheme'),
1011
+ NamedCorrelationIds: _1.mapOf('CorrelationId'),
1012
+ NamedStreamHeaders: _1.mapOf('StreamHeader'),
1013
+ ImplicitFlow,
1014
+ PasswordFlow,
1015
+ ClientCredentials,
1016
+ AuthorizationCode,
1017
+ SecuritySchemeFlows,
1018
+ SecurityScheme,
1019
+ Message,
1020
+ MessageBindings,
1021
+ OperationBindings,
1022
+ OperationTrait,
1023
+ OperationTraitList: _1.listOf('OperationTrait'),
1024
+ MessageTrait,
1025
+ MessageTraitList: _1.listOf('MessageTrait'),
1026
+ CorrelationId,
1027
+ };