@redocly/openapi-core 1.1.0 → 1.2.1

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 (77) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +250 -7
  3. package/lib/bundle.d.ts +12 -6
  4. package/lib/bundle.js +34 -24
  5. package/lib/config/builtIn.js +4 -0
  6. package/lib/config/config-resolvers.js +19 -6
  7. package/lib/config/config.d.ts +9 -9
  8. package/lib/config/config.js +32 -17
  9. package/lib/config/load.d.ts +3 -2
  10. package/lib/config/load.js +2 -2
  11. package/lib/config/rules.d.ts +2 -2
  12. package/lib/config/types.d.ts +10 -3
  13. package/lib/index.d.ts +4 -3
  14. package/lib/index.js +10 -6
  15. package/lib/lint.js +10 -16
  16. package/lib/oas-types.d.ts +16 -10
  17. package/lib/oas-types.js +52 -26
  18. package/lib/rules/async2/channels-kebab-case.d.ts +2 -0
  19. package/lib/rules/async2/channels-kebab-case.js +19 -0
  20. package/lib/rules/async2/index.d.ts +12 -0
  21. package/lib/rules/async2/index.js +22 -0
  22. package/lib/rules/async2/no-channel-trailing-slash.d.ts +2 -0
  23. package/lib/rules/async2/no-channel-trailing-slash.js +16 -0
  24. package/lib/rules/common/assertions/asserts.js +12 -4
  25. package/lib/rules/common/scalar-property-missing-example.js +1 -1
  26. package/lib/rules/common/spec.d.ts +2 -2
  27. package/lib/rules/common/spec.js +3 -3
  28. package/lib/rules/oas2/index.js +1 -1
  29. package/lib/rules/oas3/index.js +1 -1
  30. package/lib/rules/oas3/no-server-example.com.js +3 -2
  31. package/lib/types/asyncapi.d.ts +2 -0
  32. package/lib/types/asyncapi.js +1034 -0
  33. package/lib/types/oas3_1.js +8 -1
  34. package/lib/types/redocly-yaml.js +3 -0
  35. package/lib/typings/asyncapi.d.ts +21 -0
  36. package/lib/typings/asyncapi.js +2 -0
  37. package/lib/visitors.d.ts +12 -0
  38. package/lib/walk.d.ts +3 -3
  39. package/package.json +4 -2
  40. package/src/__tests__/__snapshots__/bundle.test.ts.snap +1 -1
  41. package/src/__tests__/bundle.test.ts +65 -25
  42. package/src/__tests__/fixtures/lint/openapi.yaml +10 -0
  43. package/src/__tests__/fixtures/redocly.yaml +2 -0
  44. package/src/__tests__/lint.test.ts +67 -8
  45. package/src/bundle.ts +62 -35
  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/__tests__/load.test.ts +35 -2
  49. package/src/config/builtIn.ts +4 -0
  50. package/src/config/config-resolvers.ts +25 -6
  51. package/src/config/config.ts +51 -27
  52. package/src/config/load.ts +11 -4
  53. package/src/config/rules.ts +2 -2
  54. package/src/config/types.ts +17 -4
  55. package/src/index.ts +10 -2
  56. package/src/lint.ts +13 -22
  57. package/src/oas-types.ts +59 -21
  58. package/src/rules/async2/__tests__/channels-kebab-case.test.ts +141 -0
  59. package/src/rules/async2/__tests__/no-channel-trailing-slash.test.ts +97 -0
  60. package/src/rules/async2/channels-kebab-case.ts +18 -0
  61. package/src/rules/async2/index.ts +22 -0
  62. package/src/rules/async2/no-channel-trailing-slash.ts +15 -0
  63. package/src/rules/common/assertions/asserts.ts +16 -4
  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/oas2/index.ts +2 -2
  67. package/src/rules/oas3/__tests__/no-server-example.com.test.ts +36 -1
  68. package/src/rules/oas3/__tests__/spec/spec.test.ts +1 -1
  69. package/src/rules/oas3/index.ts +2 -2
  70. package/src/rules/oas3/no-server-example.com.ts +3 -2
  71. package/src/types/asyncapi.ts +1142 -0
  72. package/src/types/oas3_1.ts +7 -1
  73. package/src/types/redocly-yaml.ts +3 -0
  74. package/src/typings/asyncapi.ts +26 -0
  75. package/src/visitors.ts +22 -0
  76. package/src/walk.ts +3 -3
  77. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,1034 @@
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: (value) => {
369
+ if (typeof value === 'boolean') {
370
+ return { type: 'boolean' };
371
+ }
372
+ else {
373
+ return 'Schema';
374
+ }
375
+ },
376
+ unevaluatedProperties: (value) => {
377
+ if (typeof value === 'boolean') {
378
+ return { type: 'boolean' };
379
+ }
380
+ else {
381
+ return 'Schema';
382
+ }
383
+ },
384
+ summary: { type: 'string' },
385
+ properties: 'SchemaProperties',
386
+ items: (value) => {
387
+ if (typeof value === 'boolean') {
388
+ return { type: 'boolean' };
389
+ }
390
+ else {
391
+ return 'Schema';
392
+ }
393
+ },
394
+ additionalProperties: (value) => {
395
+ return typeof value === 'boolean' ? { type: 'boolean' } : 'Schema';
396
+ },
397
+ description: { type: 'string' },
398
+ format: { type: 'string' },
399
+ contentEncoding: { type: 'string' },
400
+ contentMediaType: { type: 'string' },
401
+ default: null,
402
+ readOnly: { type: 'boolean' },
403
+ writeOnly: { type: 'boolean' },
404
+ // xml: 'Xml',
405
+ examples: { type: 'array' },
406
+ example: { isExample: true },
407
+ deprecated: { type: 'boolean' },
408
+ const: null,
409
+ $comment: { type: 'string' },
410
+ dependencies: { type: 'object' }, // TODO
411
+ },
412
+ };
413
+ const SchemaProperties = {
414
+ properties: {},
415
+ additionalProperties: (value) => {
416
+ if (typeof value === 'boolean') {
417
+ return { type: 'boolean' };
418
+ }
419
+ return 'Schema';
420
+ },
421
+ };
422
+ const DiscriminatorMapping = {
423
+ properties: {},
424
+ additionalProperties: (value) => {
425
+ if (ref_utils_1.isMappingRef(value)) {
426
+ return { type: 'string', directResolveAs: 'Schema' };
427
+ }
428
+ else {
429
+ return { type: 'string' };
430
+ }
431
+ },
432
+ };
433
+ const Discriminator = {
434
+ properties: {
435
+ propertyName: { type: 'string' },
436
+ mapping: 'DiscriminatorMapping',
437
+ },
438
+ required: ['propertyName'],
439
+ };
440
+ const Components = {
441
+ properties: {
442
+ messages: 'NamedMessages',
443
+ parameters: 'NamedParameters',
444
+ schemas: 'NamedSchemas',
445
+ correlationIds: 'NamedCorrelationIds',
446
+ messageTraits: 'NamedMessageTraits',
447
+ operationTraits: 'NamedOperationTraits',
448
+ streamHeaders: 'NamedStreamHeaders',
449
+ securitySchemes: 'NamedSecuritySchemes',
450
+ servers: 'ServerMap',
451
+ serverVariables: 'ServerVariablesMap',
452
+ channels: 'ChannelMap',
453
+ serverBindings: 'ServerBindings',
454
+ channelBindings: 'ChannelBindings',
455
+ operationBindings: 'OperationBindings',
456
+ messageBindings: 'MessageBindings',
457
+ },
458
+ };
459
+ const ImplicitFlow = {
460
+ properties: {
461
+ refreshUrl: { type: 'string' },
462
+ scopes: { type: 'object', additionalProperties: { type: 'string' } },
463
+ authorizationUrl: { type: 'string' },
464
+ },
465
+ required: ['authorizationUrl', 'scopes'],
466
+ };
467
+ const PasswordFlow = {
468
+ properties: {
469
+ refreshUrl: { type: 'string' },
470
+ scopes: { type: 'object', additionalProperties: { type: 'string' } },
471
+ tokenUrl: { type: 'string' },
472
+ },
473
+ required: ['tokenUrl', 'scopes'],
474
+ };
475
+ const ClientCredentials = {
476
+ properties: {
477
+ refreshUrl: { type: 'string' },
478
+ scopes: { type: 'object', additionalProperties: { type: 'string' } },
479
+ tokenUrl: { type: 'string' },
480
+ },
481
+ required: ['tokenUrl', 'scopes'],
482
+ };
483
+ const AuthorizationCode = {
484
+ properties: {
485
+ refreshUrl: { type: 'string' },
486
+ authorizationUrl: { type: 'string' },
487
+ scopes: { type: 'object', additionalProperties: { type: 'string' } },
488
+ tokenUrl: { type: 'string' },
489
+ },
490
+ required: ['authorizationUrl', 'tokenUrl', 'scopes'],
491
+ };
492
+ const SecuritySchemeFlows = {
493
+ properties: {
494
+ implicit: 'ImplicitFlow',
495
+ password: 'PasswordFlow',
496
+ clientCredentials: 'ClientCredentials',
497
+ authorizationCode: 'AuthorizationCode',
498
+ },
499
+ };
500
+ const SecurityScheme = {
501
+ properties: {
502
+ type: {
503
+ enum: [
504
+ 'userPassword',
505
+ 'apiKey',
506
+ 'X509',
507
+ 'symmetricEncryption',
508
+ 'asymmetricEncryption',
509
+ 'httpApiKey',
510
+ 'http',
511
+ 'oauth2',
512
+ 'openIdConnect',
513
+ 'plain',
514
+ 'scramSha256',
515
+ 'scramSha512',
516
+ 'gssapi',
517
+ ],
518
+ },
519
+ description: { type: 'string' },
520
+ name: { type: 'string' },
521
+ in: { type: 'string', enum: ['query', 'header', 'cookie', 'user', 'password'] },
522
+ scheme: { type: 'string' },
523
+ bearerFormat: { type: 'string' },
524
+ flows: 'SecuritySchemeFlows',
525
+ openIdConnectUrl: { type: 'string' },
526
+ },
527
+ required(value) {
528
+ switch (value === null || value === void 0 ? void 0 : value.type) {
529
+ case 'apiKey':
530
+ return ['type', 'in'];
531
+ case 'httpApiKey':
532
+ return ['type', 'name', 'in'];
533
+ case 'http':
534
+ return ['type', 'scheme'];
535
+ case 'oauth2':
536
+ return ['type', 'flows'];
537
+ case 'openIdConnect':
538
+ return ['type', 'openIdConnectUrl'];
539
+ default:
540
+ return ['type'];
541
+ }
542
+ },
543
+ allowed(value) {
544
+ switch (value === null || value === void 0 ? void 0 : value.type) {
545
+ case 'apiKey':
546
+ return ['type', 'in', 'description'];
547
+ case 'httpApiKey':
548
+ return ['type', 'name', 'in', 'description'];
549
+ case 'http':
550
+ return ['type', 'scheme', 'bearerFormat', 'description'];
551
+ case 'oauth2':
552
+ return ['type', 'flows', 'description'];
553
+ case 'openIdConnect':
554
+ return ['type', 'openIdConnectUrl', 'description'];
555
+ default:
556
+ return ['type', 'description'];
557
+ }
558
+ },
559
+ extensionsPrefix: 'x-',
560
+ };
561
+ // --- Per-protocol node types
562
+ // http
563
+ const HttpChannelBinding = {
564
+ properties: {}, // empty object
565
+ };
566
+ ChannelBindings.properties.http = HttpChannelBinding;
567
+ const HttpServerBinding = {
568
+ properties: {}, // empty object
569
+ };
570
+ ServerBindings.properties.http = HttpServerBinding;
571
+ const HttpMessageBinding = {
572
+ properties: {
573
+ headers: 'Schema',
574
+ bindingVersion: { type: 'string' },
575
+ },
576
+ };
577
+ MessageBindings.properties.http = HttpMessageBinding;
578
+ const HttpOperationBinding = {
579
+ properties: {
580
+ type: { type: 'string' },
581
+ method: {
582
+ type: 'string',
583
+ enum: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS', 'CONNECT', 'TRACE'],
584
+ },
585
+ headers: 'Schema',
586
+ bindingVersion: { type: 'string' },
587
+ },
588
+ };
589
+ OperationBindings.properties.http = HttpOperationBinding;
590
+ // ws
591
+ const WsChannelBinding = {
592
+ properties: {
593
+ method: { type: 'string' },
594
+ query: 'Schema',
595
+ headers: 'Schema',
596
+ bindingVersion: { type: 'string' },
597
+ },
598
+ };
599
+ ChannelBindings.properties.ws = WsChannelBinding;
600
+ const WsServerBinding = {
601
+ properties: {}, // empty object
602
+ };
603
+ ServerBindings.properties.ws = WsServerBinding;
604
+ const WsMessageBinding = {
605
+ properties: {}, // empty object
606
+ };
607
+ MessageBindings.properties.ws = WsMessageBinding;
608
+ const WsOperationBinding = {
609
+ properties: {}, // empty object
610
+ };
611
+ OperationBindings.properties.ws = WsOperationBinding;
612
+ // kafka
613
+ const KafkaTopicConfiguration = {
614
+ properties: {
615
+ 'cleanup.policy': { type: 'array', items: { enum: ['delete', 'compact'] } },
616
+ 'retention.ms': { type: 'integer' },
617
+ 'retention.bytes': { type: 'integer' },
618
+ 'delete.retention.ms': { type: 'integer' },
619
+ 'max.message.bytes': { type: 'integer' },
620
+ },
621
+ };
622
+ const KafkaChannelBinding = {
623
+ properties: {
624
+ topic: { type: 'string' },
625
+ partitions: { type: 'integer' },
626
+ replicas: { type: 'integer' },
627
+ topicConfiguration: 'KafkaTopicConfiguration',
628
+ bindingVersion: { type: 'string' },
629
+ },
630
+ };
631
+ ChannelBindings.properties.kafka = KafkaChannelBinding;
632
+ const KafkaServerBinding = {
633
+ properties: {}, // empty object
634
+ };
635
+ ServerBindings.properties.kafka = KafkaServerBinding;
636
+ const KafkaMessageBinding = {
637
+ properties: {
638
+ key: 'Schema',
639
+ schemaIdLocation: { type: 'string' },
640
+ schemaIdPayloadEncoding: { type: 'string' },
641
+ schemaLookupStrategy: { type: 'string' },
642
+ bindingVersion: { type: 'string' },
643
+ },
644
+ };
645
+ MessageBindings.properties.kafka = KafkaMessageBinding;
646
+ const KafkaOperationBinding = {
647
+ properties: {
648
+ groupId: 'Schema',
649
+ clientId: 'Schema',
650
+ bindingVersion: { type: 'string' },
651
+ },
652
+ };
653
+ OperationBindings.properties.kafka = KafkaOperationBinding;
654
+ // anypointmq
655
+ const AnypointmqChannelBinding = {
656
+ properties: {
657
+ destination: { type: 'string' },
658
+ destinationType: { type: 'string' },
659
+ bindingVersion: { type: 'string' },
660
+ },
661
+ };
662
+ ChannelBindings.properties.anypointmq = AnypointmqChannelBinding;
663
+ const AnypointmqServerBinding = {
664
+ properties: {}, // empty object
665
+ };
666
+ ServerBindings.properties.anypointmq = AnypointmqServerBinding;
667
+ const AnypointmqMessageBinding = {
668
+ properties: {
669
+ headers: 'Schema',
670
+ bindingVersion: { type: 'string' },
671
+ },
672
+ };
673
+ MessageBindings.properties.anypointmq = AnypointmqMessageBinding;
674
+ const AnypointmqOperationBinding = {
675
+ properties: {}, // empty object
676
+ };
677
+ OperationBindings.properties.anypointmq = AnypointmqOperationBinding;
678
+ // amqp
679
+ const AmqpChannelBinding = {
680
+ properties: {}, // empty object
681
+ };
682
+ ChannelBindings.properties.amqp = AmqpChannelBinding;
683
+ const AmqpServerBinding = {
684
+ properties: {}, // empty object
685
+ };
686
+ ServerBindings.properties.amqp = AmqpServerBinding;
687
+ const AmqpMessageBinding = {
688
+ properties: {
689
+ contentEncoding: { type: 'string' },
690
+ messageType: { type: 'string' },
691
+ bindingVersion: { type: 'string' },
692
+ },
693
+ };
694
+ MessageBindings.properties.amqp = AmqpMessageBinding;
695
+ const AmqpOperationBinding = {
696
+ // TODO: some fields are subscribe only
697
+ properties: {
698
+ expiration: { type: 'integer' },
699
+ userId: { type: 'string' },
700
+ cc: { type: 'array', items: { type: 'string' } },
701
+ priority: { type: 'integer' },
702
+ deliveryMode: { type: 'integer' },
703
+ mandatory: { type: 'boolean' },
704
+ bcc: { type: 'array', items: { type: 'string' } },
705
+ replyTo: { type: 'string' },
706
+ timestamp: { type: 'boolean' },
707
+ ack: { type: 'boolean' },
708
+ bindingVersion: { type: 'string' },
709
+ },
710
+ };
711
+ OperationBindings.properties.amqp = AmqpOperationBinding;
712
+ // amqp1
713
+ const Amqp1ChannelBinding = {
714
+ properties: {}, // empty object
715
+ };
716
+ ChannelBindings.properties.amqp1 = Amqp1ChannelBinding;
717
+ const Amqp1ServerBinding = {
718
+ properties: {}, // empty object
719
+ };
720
+ ServerBindings.properties.amqp1 = Amqp1ServerBinding;
721
+ const Amqp1MessageBinding = {
722
+ properties: {}, // empty object
723
+ };
724
+ MessageBindings.properties.amqp1 = Amqp1MessageBinding;
725
+ const Amqp1OperationBinding = {
726
+ properties: {}, // empty object
727
+ };
728
+ OperationBindings.properties.amqp1 = Amqp1OperationBinding;
729
+ // mqtt
730
+ const MqttChannelBinding = {
731
+ properties: {
732
+ qos: { type: 'integer' },
733
+ retain: { type: 'boolean' },
734
+ bindingVersion: { type: 'string' },
735
+ },
736
+ };
737
+ ChannelBindings.properties.mqtt = MqttChannelBinding;
738
+ const MqttServerBindingLastWill = {
739
+ properties: {
740
+ topic: { type: 'string' },
741
+ qos: { type: 'integer' },
742
+ message: { type: 'string' },
743
+ retain: { type: 'boolean' },
744
+ },
745
+ };
746
+ const MqttServerBinding = {
747
+ properties: {
748
+ clientId: { type: 'string' },
749
+ cleanSession: { type: 'boolean' },
750
+ lastWill: 'MqttServerBindingLastWill',
751
+ keepAlive: { type: 'integer' },
752
+ bindingVersion: { type: 'string' },
753
+ },
754
+ };
755
+ ServerBindings.properties.mqtt = MqttServerBinding;
756
+ const MqttMessageBinding = {
757
+ properties: {
758
+ bindingVersion: { type: 'string' },
759
+ },
760
+ };
761
+ MessageBindings.properties.mqtt = MqttMessageBinding;
762
+ const MqttOperationBinding = {
763
+ properties: {
764
+ qos: { type: 'integer' },
765
+ retain: { type: 'boolean' },
766
+ bindingVersion: { type: 'string' },
767
+ },
768
+ };
769
+ OperationBindings.properties.mqtt = MqttOperationBinding;
770
+ // mqtt5
771
+ const Mqtt5ChannelBinding = {
772
+ properties: {}, // empty object
773
+ };
774
+ ChannelBindings.properties.mqtt5 = Mqtt5ChannelBinding;
775
+ const Mqtt5ServerBinding = {
776
+ properties: {}, // empty object
777
+ };
778
+ ServerBindings.properties.mqtt5 = Mqtt5ServerBinding;
779
+ const Mqtt5MessageBinding = {
780
+ properties: {}, // empty object
781
+ };
782
+ MessageBindings.properties.mqtt5 = Mqtt5MessageBinding;
783
+ const Mqtt5OperationBinding = {
784
+ properties: {}, // empty object
785
+ };
786
+ OperationBindings.properties.mqtt5 = Mqtt5OperationBinding;
787
+ // nats
788
+ const NatsChannelBinding = {
789
+ properties: {}, // empty object
790
+ };
791
+ ChannelBindings.properties.nats = NatsChannelBinding;
792
+ const NatsServerBinding = {
793
+ properties: {}, // empty object
794
+ };
795
+ ServerBindings.properties.nats = NatsServerBinding;
796
+ const NatsMessageBinding = {
797
+ properties: {}, // empty object
798
+ };
799
+ MessageBindings.properties.nats = NatsMessageBinding;
800
+ const NatsOperationBinding = {
801
+ properties: {
802
+ queue: { type: 'string' },
803
+ bindingVersion: { type: 'string' },
804
+ },
805
+ };
806
+ OperationBindings.properties.nats = NatsOperationBinding;
807
+ // jms
808
+ const JmsChannelBinding = {
809
+ properties: {
810
+ destination: { type: 'string' },
811
+ destinationType: { type: 'string' },
812
+ bindingVersion: { type: 'string' },
813
+ },
814
+ };
815
+ ChannelBindings.properties.jms = JmsChannelBinding;
816
+ const JmsServerBinding = {
817
+ properties: {}, // empty object
818
+ };
819
+ ServerBindings.properties.jms = JmsServerBinding;
820
+ const JmsMessageBinding = {
821
+ properties: {
822
+ headers: 'Schema',
823
+ bindingVersion: { type: 'string' },
824
+ },
825
+ };
826
+ MessageBindings.properties.jms = JmsMessageBinding;
827
+ const JmsOperationBinding = {
828
+ properties: {
829
+ headers: 'Schema',
830
+ bindingVersion: { type: 'string' },
831
+ },
832
+ };
833
+ OperationBindings.properties.jms = JmsOperationBinding;
834
+ // sns
835
+ // solace
836
+ const SolaceChannelBinding = {
837
+ properties: {}, // empty object
838
+ };
839
+ ChannelBindings.properties.solace = SolaceChannelBinding;
840
+ const SolaceServerBinding = {
841
+ properties: {
842
+ bindingVersion: { type: 'string' },
843
+ msgVpn: { type: 'string' },
844
+ },
845
+ };
846
+ ServerBindings.properties.solace = SolaceServerBinding;
847
+ const SolaceMessageBinding = {
848
+ properties: {}, // empty object
849
+ };
850
+ MessageBindings.properties.solace = SolaceMessageBinding;
851
+ const SolaceDestination = {
852
+ properties: {
853
+ destinationType: { type: 'string', enum: ['queue', 'topic'] },
854
+ deliveryMode: { type: 'string', enum: ['direct', 'persistent'] },
855
+ 'queue.name': { type: 'string' },
856
+ 'queue.topicSubscriptions': { type: 'array', items: { type: 'string' } },
857
+ 'queue.accessType': { type: 'string', enum: ['exclusive', 'nonexclusive'] },
858
+ 'queue.maxMsgSpoolSize': { type: 'string' },
859
+ 'queue.maxTtl': { type: 'string' },
860
+ 'topic.topicSubscriptions': { type: 'array', items: { type: 'string' } },
861
+ },
862
+ };
863
+ const SolaceOperationBinding = {
864
+ properties: {
865
+ bindingVersion: { type: 'string' },
866
+ destinations: _1.listOf('SolaceDestination'),
867
+ },
868
+ };
869
+ OperationBindings.properties.solace = SolaceOperationBinding;
870
+ // sqs
871
+ // stomp
872
+ const StompChannelBinding = {
873
+ properties: {}, // empty object
874
+ };
875
+ ChannelBindings.properties.stomp = StompChannelBinding;
876
+ const StompServerBinding = {
877
+ properties: {}, // empty object
878
+ };
879
+ ServerBindings.properties.stomp = StompServerBinding;
880
+ const StompMessageBinding = {
881
+ properties: {}, // empty object
882
+ };
883
+ MessageBindings.properties.stomp = StompMessageBinding;
884
+ const StompOperationBinding = {
885
+ properties: {}, // empty object
886
+ };
887
+ OperationBindings.properties.stomp = StompOperationBinding;
888
+ // redis
889
+ const RedisChannelBinding = {
890
+ properties: {}, // empty object
891
+ };
892
+ ChannelBindings.properties.redis = RedisChannelBinding;
893
+ const RedisServerBinding = {
894
+ properties: {}, // empty object
895
+ };
896
+ ServerBindings.properties.redis = RedisServerBinding;
897
+ const RedisMessageBinding = {
898
+ properties: {}, // empty object
899
+ };
900
+ MessageBindings.properties.redis = RedisMessageBinding;
901
+ const RedisOperationBinding = {
902
+ properties: {}, // empty object
903
+ };
904
+ OperationBindings.properties.redis = RedisOperationBinding;
905
+ // mercure
906
+ const MercureChannelBinding = {
907
+ properties: {}, // empty object
908
+ };
909
+ ChannelBindings.properties.mercure = MercureChannelBinding;
910
+ const MercureServerBinding = {
911
+ properties: {}, // empty object
912
+ };
913
+ ServerBindings.properties.mercure = MercureServerBinding;
914
+ const MercureMessageBinding = {
915
+ properties: {}, // empty object
916
+ };
917
+ MessageBindings.properties.mercure = MercureMessageBinding;
918
+ const MercureOperationBinding = {
919
+ properties: {}, // empty object
920
+ };
921
+ OperationBindings.properties.mercure = MercureOperationBinding;
922
+ // ibmmq
923
+ // googlepubsub
924
+ // pulsar
925
+ // --- End per-protocol node types
926
+ exports.AsyncApi2Types = {
927
+ Root,
928
+ Tag,
929
+ TagList: _1.listOf('Tag'),
930
+ ServerMap,
931
+ ExternalDocs,
932
+ Server,
933
+ ServerVariable,
934
+ ServerVariablesMap: _1.mapOf('ServerVariable'),
935
+ SecurityRequirement,
936
+ SecurityRequirementList: _1.listOf('SecurityRequirement'),
937
+ Info,
938
+ Contact,
939
+ License,
940
+ HttpServerBinding,
941
+ HttpChannelBinding,
942
+ HttpMessageBinding,
943
+ HttpOperationBinding,
944
+ WsServerBinding,
945
+ WsChannelBinding,
946
+ WsMessageBinding,
947
+ WsOperationBinding,
948
+ KafkaServerBinding,
949
+ KafkaTopicConfiguration,
950
+ KafkaChannelBinding,
951
+ KafkaMessageBinding,
952
+ KafkaOperationBinding,
953
+ AnypointmqServerBinding,
954
+ AnypointmqChannelBinding,
955
+ AnypointmqMessageBinding,
956
+ AnypointmqOperationBinding,
957
+ AmqpServerBinding,
958
+ AmqpChannelBinding,
959
+ AmqpMessageBinding,
960
+ AmqpOperationBinding,
961
+ Amqp1ServerBinding,
962
+ Amqp1ChannelBinding,
963
+ Amqp1MessageBinding,
964
+ Amqp1OperationBinding,
965
+ MqttServerBindingLastWill,
966
+ MqttServerBinding,
967
+ MqttChannelBinding,
968
+ MqttMessageBinding,
969
+ MqttOperationBinding,
970
+ Mqtt5ServerBinding,
971
+ Mqtt5ChannelBinding,
972
+ Mqtt5MessageBinding,
973
+ Mqtt5OperationBinding,
974
+ NatsServerBinding,
975
+ NatsChannelBinding,
976
+ NatsMessageBinding,
977
+ NatsOperationBinding,
978
+ JmsServerBinding,
979
+ JmsChannelBinding,
980
+ JmsMessageBinding,
981
+ JmsOperationBinding,
982
+ SolaceServerBinding,
983
+ SolaceChannelBinding,
984
+ SolaceMessageBinding,
985
+ SolaceDestination,
986
+ SolaceOperationBinding,
987
+ StompServerBinding,
988
+ StompChannelBinding,
989
+ StompMessageBinding,
990
+ StompOperationBinding,
991
+ RedisServerBinding,
992
+ RedisChannelBinding,
993
+ RedisMessageBinding,
994
+ RedisOperationBinding,
995
+ MercureServerBinding,
996
+ MercureChannelBinding,
997
+ MercureMessageBinding,
998
+ MercureOperationBinding,
999
+ ServerBindings,
1000
+ ChannelBindings,
1001
+ ChannelMap,
1002
+ Channel,
1003
+ Parameter,
1004
+ ParametersMap: _1.mapOf('Parameter'),
1005
+ Operation,
1006
+ Schema,
1007
+ MessageExample,
1008
+ SchemaProperties,
1009
+ DiscriminatorMapping,
1010
+ Discriminator,
1011
+ Components,
1012
+ NamedSchemas: _1.mapOf('Schema'),
1013
+ NamedMessages: _1.mapOf('Message'),
1014
+ NamedMessageTraits: _1.mapOf('MessageTrait'),
1015
+ NamedOperationTraits: _1.mapOf('OperationTrait'),
1016
+ NamedParameters: _1.mapOf('Parameter'),
1017
+ NamedSecuritySchemes: _1.mapOf('SecurityScheme'),
1018
+ NamedCorrelationIds: _1.mapOf('CorrelationId'),
1019
+ NamedStreamHeaders: _1.mapOf('StreamHeader'),
1020
+ ImplicitFlow,
1021
+ PasswordFlow,
1022
+ ClientCredentials,
1023
+ AuthorizationCode,
1024
+ SecuritySchemeFlows,
1025
+ SecurityScheme,
1026
+ Message,
1027
+ MessageBindings,
1028
+ OperationBindings,
1029
+ OperationTrait,
1030
+ OperationTraitList: _1.listOf('OperationTrait'),
1031
+ MessageTrait,
1032
+ MessageTraitList: _1.listOf('MessageTrait'),
1033
+ CorrelationId,
1034
+ };